From fafe8429ba94626d1dadd948c9bff99ef5008d6e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 2 Apr 2019 02:33:18 +0000 Subject: [PATCH] Generated from 358cc2fcac3711d666771326c3427f7db554d541 Updated config files --- features/resource-manager/v2015_12_01/pom.xml | 8 +- .../v2015_12_01/OperationDisplay.java | 95 + .../implementation/FeatureClientImpl.java | 277 +- .../implementation/FeatureResultImpl.java | 1 + .../implementation/OperationInner.java | 70 + locks/resource-manager/v2016_09_01/pom.xml | 10 +- .../v2016_09_01/AuthorizationOperations.java | 27 + .../v2016_09_01/ManagementLockObject.java | 12 + .../locks/v2016_09_01/Operation.java | 30 + .../locks/v2016_09_01/OperationDisplay.java | 95 + .../AuthorizationOperationsImpl.java | 49 + .../AuthorizationOperationsInner.java | 283 ++ .../implementation/LocksManager.java | 12 + .../ManagementLockClientImpl.java | 34 +- .../ManagementLockObjectImpl.java | 4 +- .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + policy/resource-manager/v2016_12_01/pom.xml | 10 +- .../policy/v2016_12_01/PolicyAssignment.java | 22 + .../policy/v2016_12_01/PolicyAssignments.java | 6 +- .../policy/v2016_12_01/PolicyDefinition.java | 28 + .../implementation/PolicyAssignmentImpl.java | 4 +- .../PolicyAssignmentsInner.java | 24 +- .../implementation/PolicyClientImpl.java | 20 +- .../implementation/PolicyDefinitionImpl.java | 4 +- policy/resource-manager/v2018_03_01/pom.xml | 8 +- .../policy/v2018_03_01/ErrorResponse.java | 2 +- .../policy/v2018_03_01/PolicyAssignment.java | 34 + .../policy/v2018_03_01/PolicyDefinition.java | 28 + .../v2018_03_01/PolicySetDefinition.java | 22 + .../implementation/PolicyAssignmentImpl.java | 4 +- .../implementation/PolicyClientImpl.java | 20 +- .../implementation/PolicyDefinitionImpl.java | 4 +- .../PolicySetDefinitionImpl.java | 4 +- policy/resource-manager/v2018_05_01/pom.xml | 133 + .../policy/v2018_05_01/ErrorResponse.java | 96 + .../v2018_05_01/ErrorResponseException.java | 44 + .../policy/v2018_05_01/Identity.java | 73 + .../policy/v2018_05_01/PolicyAssignment.java | 378 +++ .../policy/v2018_05_01/PolicyAssignments.java | 91 + .../policy/v2018_05_01/PolicyDefinition.java | 278 ++ .../PolicyDefinitionReference.java | 69 + .../policy/v2018_05_01/PolicyDefinitions.java | 106 + .../policy/v2018_05_01/PolicyMode.java | 44 + .../v2018_05_01/PolicySetDefinition.java | 238 ++ .../v2018_05_01/PolicySetDefinitions.java | 106 + .../policy/v2018_05_01/PolicySku.java | 69 + .../policy/v2018_05_01/PolicyType.java | 44 + .../v2018_05_01/ResourceIdentityType.java | 53 + .../implementation/IdParsingUtils.java | 57 + .../v2018_05_01/implementation/PageImpl.java | 75 + .../implementation/PolicyAssignmentImpl.java | 205 ++ .../implementation/PolicyAssignmentInner.java | 285 ++ .../implementation/PolicyAssignmentsImpl.java | 179 ++ .../PolicyAssignmentsInner.java | 1748 +++++++++++ .../implementation/PolicyClientImpl.java | 224 ++ .../implementation/PolicyDefinitionImpl.java | 163 + .../implementation/PolicyDefinitionInner.java | 207 ++ .../implementation/PolicyDefinitionsImpl.java | 174 ++ .../PolicyDefinitionsInner.java | 1410 +++++++++ .../implementation/PolicyManager.java | 123 + .../PolicySetDefinitionImpl.java | 153 + .../PolicySetDefinitionInner.java | 182 ++ .../PolicySetDefinitionsImpl.java | 174 ++ .../PolicySetDefinitionsInner.java | 1412 +++++++++ .../implementation/package-info.java | 11 + .../policy/v2018_05_01/package-info.java | 11 + .../resource-manager/v2016_06_01/pom.xml | 14 +- .../resources/v2016_06_01/Location.java | 4 +- .../resources/v2016_06_01/Operation.java | 30 + .../v2016_06_01/OperationDisplay.java | 121 + .../resources/v2016_06_01/Operations.java | 27 + .../resources/v2016_06_01/Subscription.java | 4 +- .../resources/v2016_06_01/Subscriptions.java | 14 +- .../v2016_06_01/TenantIdDescription.java | 4 +- .../implementation/LocationImpl.java | 6 +- .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v2016_06_01/implementation/PageImpl.java | 2 +- .../v2016_06_01/implementation/PageImpl1.java | 2 +- .../implementation/ResourcesManager.java | 120 + .../SubscriptionClientImpl.java | 34 +- .../implementation/SubscriptionImpl.java | 6 +- .../implementation/SubscriptionsImpl.java | 28 +- .../implementation/SubscriptionsInner.java | 26 +- .../TenantIdDescriptionImpl.java | 6 +- .../implementation/TenantsImpl.java | 6 +- .../implementation/TenantsInner.java | 18 +- .../resource-manager/v2016_09_01/pom.xml | 8 +- .../v2016_09_01/DeploymentExtended.java | 6 + .../DeploymentPropertiesExtended.java | 6 +- .../resources/v2016_09_01/Deployments.java | 2 +- .../resources/v2016_09_01/ParametersLink.java | 2 +- .../resources/v2016_09_01/ResourceGroup.java | 19 + .../resources/v2016_09_01/ResourceGroups.java | 2 +- .../resources/v2016_09_01/Resources.java | 6 +- .../DeploymentExtendedImpl.java | 4 +- .../DeploymentOperationImpl.java | 1 + .../implementation/DeploymentsImpl.java | 6 +- .../implementation/ProviderImpl.java | 1 + .../implementation/ResourceGroupImpl.java | 2 +- .../implementation/ResourceGroupInner.java | 6 +- .../implementation/ResourceGroupsImpl.java | 6 +- .../ResourceManagementClientImpl.java | 20 +- .../implementation/ResourcesImpl.java | 12 +- .../implementation/ResourcesInner.java | 16 +- .../resource-manager/v2018_02_01/pom.xml | 10 +- .../v2018_02_01/DeploymentExtended.java | 6 + .../DeploymentPropertiesExtended.java | 6 +- .../resources/v2018_02_01/Deployments.java | 2 +- .../resources/v2018_02_01/ParametersLink.java | 2 +- .../resources/v2018_02_01/ResourceGroup.java | 19 + .../resources/v2018_02_01/ResourceGroups.java | 2 +- .../resources/v2018_02_01/Resources.java | 4 +- .../DeploymentExtendedImpl.java | 4 +- .../DeploymentOperationImpl.java | 1 + .../implementation/DeploymentsImpl.java | 6 +- .../implementation/ProviderImpl.java | 1 + .../implementation/ResourceGroupImpl.java | 2 +- .../implementation/ResourceGroupsImpl.java | 6 +- .../ResourceManagementClientImpl.java | 20 +- .../implementation/ResourcesImpl.java | 12 +- .../resource-manager/v2018_06_01/pom.xml | 133 + .../resources/v2018_06_01/Location.java | 50 + .../resources/v2018_06_01/Operation.java | 30 + .../v2018_06_01/OperationDisplay.java | 121 + .../resources/v2018_06_01/Operations.java | 27 + .../resources/v2018_06_01/SpendingLimit.java | 56 + .../resources/v2018_06_01/Subscription.java | 55 + .../v2018_06_01/SubscriptionPolicies.java | 66 + .../v2018_06_01/SubscriptionState.java | 62 + .../resources/v2018_06_01/Subscriptions.java | 47 + .../v2018_06_01/TenantIdDescription.java | 30 + .../resources/v2018_06_01/Tenants.java | 27 + .../implementation/IdParsingUtils.java | 57 + .../implementation/LocationImpl.java | 60 + .../implementation/LocationInner.java | 108 + .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v2018_06_01/implementation/PageImpl.java | 75 + .../v2018_06_01/implementation/PageImpl1.java | 75 + .../implementation/ResourcesManager.java | 120 + .../SubscriptionClientImpl.java | 201 ++ .../implementation/SubscriptionImpl.java | 63 + .../implementation/SubscriptionInner.java | 151 + .../implementation/SubscriptionsImpl.java | 85 + .../implementation/SubscriptionsInner.java | 454 +++ .../TenantIdDescriptionImpl.java | 36 + .../TenantIdDescriptionInner.java | 48 + .../implementation/TenantsImpl.java | 49 + .../implementation/TenantsInner.java | 283 ++ .../implementation/package-info.java | 11 + .../resources/v2018_06_01/package-info.java | 11 + .../resource-manager/v2019_03_01/pom.xml | 133 + .../resources/v2019_03_01/AliasPathType.java | 70 + .../resources/v2019_03_01/AliasType.java | 70 + .../v2019_03_01/BasicDependency.java | 95 + .../resources/v2019_03_01/DebugSetting.java | 49 + .../resources/v2019_03_01/Dependency.java | 122 + .../v2019_03_01/DeploymentExportResult.java | 25 + .../v2019_03_01/DeploymentExtended.java | 133 + .../v2019_03_01/DeploymentExtendedFilter.java | 43 + .../resources/v2019_03_01/DeploymentMode.java | 53 + .../v2019_03_01/DeploymentOperation.java | 37 + .../DeploymentOperationProperties.java | 138 + .../v2019_03_01/DeploymentOperations.java | 59 + .../v2019_03_01/DeploymentProperties.java | 216 ++ .../DeploymentPropertiesExtended.java | 328 ++ .../v2019_03_01/DeploymentValidateResult.java | 30 + .../resources/v2019_03_01/Deployments.java | 137 + .../v2019_03_01/ExportTemplateRequest.java | 74 + .../v2019_03_01/GenericResource.java | 76 + .../v2019_03_01/GenericResourceFilter.java | 95 + .../resources/v2019_03_01/HttpMessage.java | 43 + .../resources/v2019_03_01/Identity.java | 103 + .../IdentityUserAssignedIdentitiesValue.java | 47 + .../v2019_03_01/OnErrorDeployment.java | 71 + .../OnErrorDeploymentExtended.java | 86 + .../v2019_03_01/OnErrorDeploymentType.java | 53 + .../resources/v2019_03_01/Operation.java | 30 + .../v2019_03_01/OperationDisplay.java | 121 + .../resources/v2019_03_01/Operations.java | 27 + .../resources/v2019_03_01/ParametersLink.java | 69 + .../resources/v2019_03_01/Plan.java | 147 + .../resources/v2019_03_01/Provider.java | 48 + .../v2019_03_01/ProviderResourceType.java | 175 ++ .../resources/v2019_03_01/Providers.java | 54 + .../resources/v2019_03_01/ResourceGroup.java | 203 ++ .../ResourceGroupExportResult.java | 30 + .../v2019_03_01/ResourceGroupFilter.java | 69 + .../v2019_03_01/ResourceGroupPatchable.java | 122 + .../v2019_03_01/ResourceGroupProperties.java | 32 + .../resources/v2019_03_01/ResourceGroups.java | 67 + .../v2019_03_01/ResourceIdentityType.java | 59 + .../ResourceManagementErrorWithDetails.java | 78 + ...rceProviderOperationDisplayProperties.java | 147 + .../resources/v2019_03_01/Resources.java | 184 ++ .../v2019_03_01/ResourcesMoveInfo.java | 70 + .../management/resources/v2019_03_01/Sku.java | 173 ++ .../resources/v2019_03_01/TagCount.java | 69 + .../resources/v2019_03_01/TagDetails.java | 41 + .../resources/v2019_03_01/TagValue.java | 35 + .../resources/v2019_03_01/Tags.java | 67 + .../resources/v2019_03_01/TargetResource.java | 95 + .../resources/v2019_03_01/TemplateLink.java | 69 + .../DeploymentExportResultImpl.java | 31 + .../DeploymentExportResultInner.java | 43 + .../DeploymentExtendedImpl.java | 137 + .../DeploymentExtendedInner.java | 71 + .../implementation/DeploymentInner.java | 70 + .../DeploymentOperationImpl.java | 57 + .../DeploymentOperationInner.java | 74 + .../DeploymentOperationsImpl.java | 95 + .../DeploymentOperationsInner.java | 961 ++++++ .../DeploymentValidateResultImpl.java | 38 + .../DeploymentValidateResultInner.java | 71 + .../implementation/DeploymentsImpl.java | 285 ++ .../implementation/DeploymentsInner.java | 2342 ++++++++++++++ .../implementation/GenericResourceImpl.java | 89 + .../implementation/GenericResourceInner.java | 179 ++ .../implementation/IdParsingUtils.java | 57 + .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v2019_03_01/implementation/PageImpl.java | 75 + .../implementation/ProviderImpl.java | 66 + .../implementation/ProviderInner.java | 105 + .../implementation/ProvidersImpl.java | 89 + .../implementation/ProvidersInner.java | 727 +++++ .../ResourceGroupExportResultImpl.java | 37 + .../ResourceGroupExportResultInner.java | 70 + .../implementation/ResourceGroupImpl.java | 174 ++ .../implementation/ResourceGroupInner.java | 71 + .../implementation/ResourceGroupsImpl.java | 101 + .../implementation/ResourceGroupsInner.java | 1010 +++++++ .../ResourceManagementClientImpl.java | 280 ++ .../implementation/ResourcesImpl.java | 181 ++ .../implementation/ResourcesInner.java | 2682 +++++++++++++++++ .../implementation/ResourcesManager.java | 171 ++ .../implementation/TagDetailsImpl.java | 60 + .../implementation/TagDetailsInner.java | 113 + .../implementation/TagValueImpl.java | 42 + .../implementation/TagValueInner.java | 85 + .../v2019_03_01/implementation/TagsImpl.java | 91 + .../v2019_03_01/implementation/TagsInner.java | 646 ++++ .../implementation/package-info.java | 11 + .../resources/v2019_03_01/package-info.java | 11 + 252 files changed, 30482 insertions(+), 264 deletions(-) create mode 100644 features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java create mode 100644 features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/OperationInner.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/AuthorizationOperations.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/Operation.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/OperationDisplay.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsImpl.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsInner.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/OperationImpl.java create mode 100644 locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/OperationInner.java create mode 100644 policy/resource-manager/v2018_05_01/pom.xml create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponse.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponseException.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/Identity.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignment.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignments.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinition.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitionReference.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitions.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyMode.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinition.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinitions.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySku.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyType.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ResourceIdentityType.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/IdParsingUtils.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PageImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentInner.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsInner.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyClientImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionInner.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsInner.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyManager.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionInner.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsImpl.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsInner.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/package-info.java create mode 100644 policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/package-info.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operation.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/OperationDisplay.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operations.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationImpl.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationInner.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsImpl.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsInner.java create mode 100644 resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/ResourcesManager.java create mode 100644 resources/resource-manager/v2018_06_01/pom.xml create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/IdParsingUtils.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/package-info.java create mode 100644 resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/package-info.java create mode 100644 resources/resource-manager/v2019_03_01/pom.xml create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasPathType.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasType.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/BasicDependency.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DebugSetting.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Dependency.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExportResult.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtended.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtendedFilter.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentMode.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperation.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperationProperties.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperations.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentProperties.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentPropertiesExtended.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentValidateResult.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Deployments.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ExportTemplateRequest.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResource.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResourceFilter.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/HttpMessage.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Identity.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/IdentityUserAssignedIdentitiesValue.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeployment.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentExtended.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentType.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operation.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OperationDisplay.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operations.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ParametersLink.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Plan.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Provider.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ProviderResourceType.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Providers.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroup.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupExportResult.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupFilter.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupPatchable.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupProperties.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroups.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceIdentityType.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceManagementErrorWithDetails.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceProviderOperationDisplayProperties.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Resources.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourcesMoveInfo.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Sku.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagCount.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagDetails.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagValue.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Tags.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TargetResource.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TemplateLink.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/IdParsingUtils.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/PageImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceManagementClientImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesManager.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsImpl.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsInner.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/package-info.java create mode 100644 resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/package-info.java diff --git a/features/resource-manager/v2015_12_01/pom.xml b/features/resource-manager/v2015_12_01/pom.xml index 0eec0e2dce11a..f5a1268fb93dc 100644 --- a/features/resource-manager/v2015_12_01/pom.xml +++ b/features/resource-manager/v2015_12_01/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-features @@ -19,7 +19,7 @@ jar Microsoft Azure SDK for Features Management This package contains Microsoft Features Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.java new file mode 100644 index 0000000000000..13e97b37c8aec --- /dev/null +++ b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/OperationDisplay.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.features.v2015_12_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Features. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get service provider: Microsoft.Features. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Features. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java index db2b6732bd674..a6c74d7761c41 100644 --- a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java +++ b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureClientImpl.java @@ -8,15 +8,36 @@ package com.microsoft.azure.management.features.v2015_12_01.implementation; +import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; /** * Initializes a new instance of the FeatureClientImpl class. */ public class FeatureClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private FeatureClientService service; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; @@ -63,11 +84,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +97,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +107,11 @@ public FeatureClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +120,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +130,11 @@ public FeatureClientImpl withLongRunningOperationRetryTimeout(int longRunningOpe return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +143,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -182,6 +203,7 @@ protected void initialize() { this.generateClientRequestId = true; this.features = new FeaturesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); + initializeService(); } /** @@ -191,6 +213,241 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "FeatureClient", "2015-12-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "FeatureClient", "2015-12-01"); } + + private void initializeService() { + service = restClient().retrofit().create(FeatureClientService.class); + } + + /** + * The interface defining all the services for FeatureClient to be + * used by Retrofit to perform actually REST calls. + */ + interface FeatureClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.features.v2015_12_01.FeatureClient listOperations" }) + @GET("providers/Microsoft.Features/operations") + Observable> listOperations(@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.features.v2015_12_01.FeatureClient listOperationsNext" }) + @GET + Observable> listOperationsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listOperations() { + ServiceResponse> response = listOperationsSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @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> listOperationsAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOperationsSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listOperationsAsync() { + return listOperationsWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listOperationsWithServiceResponseAsync() { + return listOperationsSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOperationsSinglePageAsync() { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + return service.listOperations(this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOperationsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOperationsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory()., CloudException>newInstance(this.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listOperationsNext(final String nextPageLink) { + ServiceResponse> response = listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listOperationsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOperationsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listOperationsNextAsync(final String nextPageLink) { + return listOperationsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listOperationsNextWithServiceResponseAsync(final String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Features REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOperationsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listOperationsNext(nextUrl, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOperationsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOperationsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory()., CloudException>newInstance(this.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java index ee2a56edd3f33..e4322acf92332 100644 --- a/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java +++ b/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeatureResultImpl.java @@ -21,6 +21,7 @@ class FeatureResultImpl extends IndexableRefreshableWrapperImpl com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-locks - 1.0.0-beta-1 + 1.0.0-beta jar Microsoft Azure SDK for Authorization Management This package contains Microsoft Authorization Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/AuthorizationOperations.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/AuthorizationOperations.java new file mode 100644 index 0000000000000..6318ce0b2cdbf --- /dev/null +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/AuthorizationOperations.java @@ -0,0 +1,27 @@ +/** + * 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.locks.v2016_09_01; + +import rx.Observable; +import com.microsoft.azure.management.locks.v2016_09_01.implementation.AuthorizationOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AuthorizationOperations. + */ +public interface AuthorizationOperations extends HasInner { + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/ManagementLockObject.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/ManagementLockObject.java index a29317269ae99..b1e6c380e8f6a 100644 --- a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/ManagementLockObject.java +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/ManagementLockObject.java @@ -75,6 +75,8 @@ interface Blank extends WithResourceGroupName { interface WithResourceGroupName { /** * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group to lock + * @return the next definition stage */ WithLevel withResourceGroupName(String resourceGroupName); } @@ -85,6 +87,8 @@ interface WithResourceGroupName { interface WithLevel { /** * Specifies level. + * @param level The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. Possible values include: 'NotSpecified', 'CanNotDelete', 'ReadOnly' + * @return the next definition stage */ WithCreate withLevel(LockLevel level); } @@ -95,6 +99,8 @@ interface WithLevel { interface WithNotes { /** * Specifies notes. + * @param notes Notes about the lock. Maximum of 512 characters + * @return the next definition stage */ WithCreate withNotes(String notes); } @@ -105,6 +111,8 @@ interface WithNotes { interface WithOwners { /** * Specifies owners. + * @param owners The owners of the lock + * @return the next definition stage */ WithCreate withOwners(List owners); } @@ -133,6 +141,8 @@ interface UpdateStages { interface WithNotes { /** * Specifies notes. + * @param notes Notes about the lock. Maximum of 512 characters + * @return the next update stage */ Update withNotes(String notes); } @@ -143,6 +153,8 @@ interface WithNotes { interface WithOwners { /** * Specifies owners. + * @param owners The owners of the lock + * @return the next update stage */ Update withOwners(List owners); } diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/Operation.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/Operation.java new file mode 100644 index 0000000000000..8c7fe11723429 --- /dev/null +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/Operation.java @@ -0,0 +1,30 @@ +/** + * 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.locks.v2016_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.locks.v2016_09_01.implementation.LocksManager; +import com.microsoft.azure.management.locks.v2016_09_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/OperationDisplay.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/OperationDisplay.java new file mode 100644 index 0000000000000..e23dbc327b579 --- /dev/null +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/OperationDisplay.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.locks.v2016_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Authorization. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get service provider: Microsoft.Authorization. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Authorization. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsImpl.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsImpl.java new file mode 100644 index 0000000000000..b6a2594aec758 --- /dev/null +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsImpl.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.locks.v2016_09_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.locks.v2016_09_01.AuthorizationOperations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.locks.v2016_09_01.Operation; + +class AuthorizationOperationsImpl extends WrapperImpl implements AuthorizationOperations { + private final LocksManager manager; + + AuthorizationOperationsImpl(LocksManager manager) { + super(manager.inner().authorizationOperations()); + this.manager = manager; + } + + public LocksManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + AuthorizationOperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsInner.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsInner.java new file mode 100644 index 0000000000000..a5e92ba6383e8 --- /dev/null +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/AuthorizationOperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.locks.v2016_09_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AuthorizationOperations. + */ +public class AuthorizationOperationsInner { + /** The Retrofit service to perform REST calls. */ + private AuthorizationOperationsService service; + /** The service client containing this operation class. */ + private ManagementLockClientImpl client; + + /** + * Initializes an instance of AuthorizationOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AuthorizationOperationsInner(Retrofit retrofit, ManagementLockClientImpl client) { + this.service = retrofit.create(AuthorizationOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AuthorizationOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface AuthorizationOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.locks.v2016_09_01.AuthorizationOperations list" }) + @GET("providers/Microsoft.Authorization/operations") + Observable> list(@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.locks.v2016_09_01.AuthorizationOperations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Authorization REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/LocksManager.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/LocksManager.java index c477e6c55f896..199858cac37d7 100644 --- a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/LocksManager.java +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/LocksManager.java @@ -16,6 +16,7 @@ import com.microsoft.azure.arm.resources.AzureConfigurable; import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.locks.v2016_09_01.AuthorizationOperations; import com.microsoft.azure.management.locks.v2016_09_01.ManagementLocks; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -24,6 +25,7 @@ * Entry point to Azure Authorization resource management. */ public final class LocksManager extends ManagerCore { + private AuthorizationOperations authorizationOperations; private ManagementLocks managementLocks; /** * Get a Configurable instance that can be used to create LocksManager with optional configuration. @@ -72,6 +74,16 @@ public interface Configurable extends AzureConfigurable { LocksManager authenticate(AzureTokenCredentials credentials, String subscriptionId); } + /** + * @return Entry point to manage AuthorizationOperations. + */ + public AuthorizationOperations authorizationOperations() { + if (this.authorizationOperations == null) { + this.authorizationOperations = new AuthorizationOperationsImpl(this); + } + return this.authorizationOperations; + } + /** * @return Entry point to manage ManagementLocks. */ diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockClientImpl.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockClientImpl.java index ecedf9e3d14f3..1c7720448b36d 100644 --- a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockClientImpl.java +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockClientImpl.java @@ -63,11 +63,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +76,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +86,11 @@ public ManagementLockClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +99,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +109,11 @@ public ManagementLockClientImpl withLongRunningOperationRetryTimeout(int longRun return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +122,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -132,6 +132,19 @@ public ManagementLockClientImpl withGenerateClientRequestId(boolean generateClie return this; } + /** + * The AuthorizationOperationsInner object to access its operations. + */ + private AuthorizationOperationsInner authorizationOperations; + + /** + * Gets the AuthorizationOperationsInner object to access its operations. + * @return the AuthorizationOperationsInner object. + */ + public AuthorizationOperationsInner authorizationOperations() { + return this.authorizationOperations; + } + /** * The ManagementLocksInner object to access its operations. */ @@ -180,6 +193,7 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; + this.authorizationOperations = new AuthorizationOperationsInner(restClient().retrofit(), this); this.managementLocks = new ManagementLocksInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } @@ -191,6 +205,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "ManagementLockClient", "2016-09-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ManagementLockClient", "2016-09-01"); } } diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockObjectImpl.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockObjectImpl.java index 47579b4f1ba0c..bacf67e5e00a4 100644 --- a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockObjectImpl.java +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLockObjectImpl.java @@ -34,10 +34,10 @@ class ManagementLockObjectImpl extends CreatableUpdatableImpl implements Operation { + private final LocksManager manager; + OperationImpl(OperationInner inner, LocksManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LocksManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/OperationInner.java b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..218a9b8c5f480 --- /dev/null +++ b/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/OperationInner.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.locks.v2016_09_01.implementation; + +import com.microsoft.azure.management.locks.v2016_09_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Authorization operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/policy/resource-manager/v2016_12_01/pom.xml b/policy/resource-manager/v2016_12_01/pom.xml index 46843fc0ca4cc..6245e5813d113 100644 --- a/policy/resource-manager/v2016_12_01/pom.xml +++ b/policy/resource-manager/v2016_12_01/pom.xml @@ -11,15 +11,15 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-policy - 1.0.0-beta-1 + 1.0.0-beta jar Microsoft Azure SDK for Authorization Management This package contains Microsoft Authorization Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignment.java b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignment.java index e682d922d322b..53125a6564f9f 100644 --- a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignment.java +++ b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignment.java @@ -84,6 +84,8 @@ interface Blank extends WithScope { interface WithScope { /** * Specifies scope. + * @param scope The scope of the policy assignment + * @return the next definition stage */ WithCreate withScope(String scope); } @@ -94,6 +96,8 @@ interface WithScope { interface WithDescription { /** * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next definition stage */ WithCreate withDescription(String description); } @@ -104,6 +108,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next definition stage */ WithCreate withDisplayName(String displayName); } @@ -114,6 +120,8 @@ interface WithDisplayName { interface WithParameters { /** * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage */ WithCreate withParameters(Object parameters); } @@ -124,6 +132,8 @@ interface WithParameters { interface WithPolicyDefinitionId { /** * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition + * @return the next definition stage */ WithCreate withPolicyDefinitionId(String policyDefinitionId); } @@ -134,6 +144,8 @@ interface WithPolicyDefinitionId { interface WithScopeProperty { /** * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next definition stage */ WithCreate withScopeProperty(String scopeProperty); } @@ -162,6 +174,8 @@ interface UpdateStages { interface WithDescription { /** * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next update stage */ Update withDescription(String description); } @@ -172,6 +186,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next update stage */ Update withDisplayName(String displayName); } @@ -182,6 +198,8 @@ interface WithDisplayName { interface WithParameters { /** * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage */ Update withParameters(Object parameters); } @@ -192,6 +210,8 @@ interface WithParameters { interface WithPolicyDefinitionId { /** * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition + * @return the next update stage */ Update withPolicyDefinitionId(String policyDefinitionId); } @@ -202,6 +222,8 @@ interface WithPolicyDefinitionId { interface WithScopeProperty { /** * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next update stage */ Update withScopeProperty(String scopeProperty); } diff --git a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignments.java b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignments.java index cabdc102fa344..9e9ecbad2ce1f 100644 --- a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignments.java +++ b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/PolicyAssignments.java @@ -56,7 +56,7 @@ public interface PolicyAssignments extends SupportsCreating> listDelegate(Response deleteByIdAsync(String policyAssignm /** * Deletes a policy assignment by ID. - * When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. + * When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. * * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -1156,7 +1156,7 @@ public PolicyAssignmentInner call(ServiceResponse respons /** * Deletes a policy assignment by ID. - * When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. + * When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. * * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -1192,7 +1192,7 @@ private ServiceResponse deleteByIdDelegate(Response createByIdAsync(String policyAssignm /** * Creates a policy assignment by ID. - * Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. + * Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. * * @param policyAssignmentId The ID of the policy assignment to create. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. * @param parameters Parameters for policy assignment. @@ -1239,7 +1239,7 @@ public PolicyAssignmentInner call(ServiceResponse respons /** * Creates a policy assignment by ID. - * Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. + * Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. * * @param policyAssignmentId The ID of the policy assignment to create. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. * @param parameters Parameters for policy assignment. @@ -1280,7 +1280,7 @@ private ServiceResponse createByIdDelegate(Response getByIdAsync(String policyAssignment /** * Gets a policy assignment by ID. - * When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. + * When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. * * @param policyAssignmentId The ID of the policy assignment to get. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -1324,7 +1324,7 @@ public PolicyAssignmentInner call(ServiceResponse respons /** * Gets a policy assignment by ID. - * When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. + * When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. * * @param policyAssignmentId The ID of the policy assignment to get. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyClientImpl.java b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyClientImpl.java index 3dde62ee59924..71ccaf379d555 100644 --- a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyClientImpl.java +++ b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyClientImpl.java @@ -63,11 +63,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +76,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +86,11 @@ public PolicyClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +99,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +109,11 @@ public PolicyClientImpl withLongRunningOperationRetryTimeout(int longRunningOper return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +122,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -205,6 +205,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "PolicyClient", "2016-12-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyClient", "2016-12-01"); } } diff --git a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionImpl.java b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionImpl.java index 9bb8daa067261..6edb014a0d0f8 100644 --- a/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionImpl.java +++ b/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionImpl.java @@ -32,9 +32,9 @@ class PolicyDefinitionImpl extends CreatableUpdatableImpl com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-policy @@ -19,7 +19,7 @@ jar Microsoft Azure SDK for Authorization Management This package contains Microsoft Authorization Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/ErrorResponse.java b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/ErrorResponse.java index bfb90927f7db6..fedfcf17ff6e4 100644 --- a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/ErrorResponse.java +++ b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/ErrorResponse.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Error reponse indicates Azure Resource Manager is not able to process the + * Error response indicates Azure Resource Manager is not able to process the * incoming request. The reason is provided in the error message. */ public class ErrorResponse { diff --git a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyAssignment.java b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyAssignment.java index 6fee8e37c428a..4c42fca2951d1 100644 --- a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyAssignment.java +++ b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyAssignment.java @@ -100,6 +100,8 @@ interface Blank extends WithScope { interface WithScope { /** * Specifies scope. + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @return the next definition stage */ WithCreate withScope(String scope); } @@ -110,6 +112,8 @@ interface WithScope { interface WithDescription { /** * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next definition stage */ WithCreate withDescription(String description); } @@ -120,6 +124,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next definition stage */ WithCreate withDisplayName(String displayName); } @@ -130,6 +136,8 @@ interface WithDisplayName { interface WithMetadata { /** * Specifies metadata. + * @param metadata The policy assignment metadata + * @return the next definition stage */ WithCreate withMetadata(Object metadata); } @@ -140,6 +148,8 @@ interface WithMetadata { interface WithNotScopes { /** * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next definition stage */ WithCreate withNotScopes(List notScopes); } @@ -150,6 +160,8 @@ interface WithNotScopes { interface WithParameters { /** * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage */ WithCreate withParameters(Object parameters); } @@ -160,6 +172,8 @@ interface WithParameters { interface WithPolicyDefinitionId { /** * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next definition stage */ WithCreate withPolicyDefinitionId(String policyDefinitionId); } @@ -170,6 +184,8 @@ interface WithPolicyDefinitionId { interface WithScopeProperty { /** * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next definition stage */ WithCreate withScopeProperty(String scopeProperty); } @@ -180,6 +196,8 @@ interface WithScopeProperty { interface WithSku { /** * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next definition stage */ WithCreate withSku(PolicySku sku); } @@ -208,6 +226,8 @@ interface UpdateStages { interface WithDescription { /** * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next update stage */ Update withDescription(String description); } @@ -218,6 +238,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next update stage */ Update withDisplayName(String displayName); } @@ -228,6 +250,8 @@ interface WithDisplayName { interface WithMetadata { /** * Specifies metadata. + * @param metadata The policy assignment metadata + * @return the next update stage */ Update withMetadata(Object metadata); } @@ -238,6 +262,8 @@ interface WithMetadata { interface WithNotScopes { /** * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next update stage */ Update withNotScopes(List notScopes); } @@ -248,6 +274,8 @@ interface WithNotScopes { interface WithParameters { /** * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage */ Update withParameters(Object parameters); } @@ -258,6 +286,8 @@ interface WithParameters { interface WithPolicyDefinitionId { /** * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next update stage */ Update withPolicyDefinitionId(String policyDefinitionId); } @@ -268,6 +298,8 @@ interface WithPolicyDefinitionId { interface WithScopeProperty { /** * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next update stage */ Update withScopeProperty(String scopeProperty); } @@ -278,6 +310,8 @@ interface WithScopeProperty { interface WithSku { /** * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next update stage */ Update withSku(PolicySku sku); } diff --git a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyDefinition.java b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyDefinition.java index ead6195a8b94e..4a2a408fd6693 100644 --- a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyDefinition.java +++ b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicyDefinition.java @@ -94,6 +94,8 @@ interface Blank extends WithCreate { interface WithDescription { /** * Specifies description. + * @param description The policy definition description + * @return the next definition stage */ WithCreate withDescription(String description); } @@ -104,6 +106,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next definition stage */ WithCreate withDisplayName(String displayName); } @@ -114,6 +118,8 @@ interface WithDisplayName { interface WithMetadata { /** * Specifies metadata. + * @param metadata The policy definition metadata + * @return the next definition stage */ WithCreate withMetadata(Object metadata); } @@ -124,6 +130,8 @@ interface WithMetadata { interface WithMode { /** * Specifies mode. + * @param mode The policy definition mode. Possible values are NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', 'Indexed', 'All' + * @return the next definition stage */ WithCreate withMode(PolicyMode mode); } @@ -134,6 +142,8 @@ interface WithMode { interface WithParameters { /** * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage */ WithCreate withParameters(Object parameters); } @@ -144,6 +154,8 @@ interface WithParameters { interface WithPolicyRule { /** * Specifies policyRule. + * @param policyRule The policy rule + * @return the next definition stage */ WithCreate withPolicyRule(Object policyRule); } @@ -154,6 +166,8 @@ interface WithPolicyRule { interface WithPolicyType { /** * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next definition stage */ WithCreate withPolicyType(PolicyType policyType); } @@ -182,6 +196,8 @@ interface UpdateStages { interface WithDescription { /** * Specifies description. + * @param description The policy definition description + * @return the next update stage */ Update withDescription(String description); } @@ -192,6 +208,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next update stage */ Update withDisplayName(String displayName); } @@ -202,6 +220,8 @@ interface WithDisplayName { interface WithMetadata { /** * Specifies metadata. + * @param metadata The policy definition metadata + * @return the next update stage */ Update withMetadata(Object metadata); } @@ -212,6 +232,8 @@ interface WithMetadata { interface WithMode { /** * Specifies mode. + * @param mode The policy definition mode. Possible values are NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', 'Indexed', 'All' + * @return the next update stage */ Update withMode(PolicyMode mode); } @@ -222,6 +244,8 @@ interface WithMode { interface WithParameters { /** * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage */ Update withParameters(Object parameters); } @@ -232,6 +256,8 @@ interface WithParameters { interface WithPolicyRule { /** * Specifies policyRule. + * @param policyRule The policy rule + * @return the next update stage */ Update withPolicyRule(Object policyRule); } @@ -242,6 +268,8 @@ interface WithPolicyRule { interface WithPolicyType { /** * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next update stage */ Update withPolicyType(PolicyType policyType); } diff --git a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicySetDefinition.java b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicySetDefinition.java index e785e4d1ee955..73b439fcfd0e1 100644 --- a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicySetDefinition.java +++ b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/PolicySetDefinition.java @@ -90,6 +90,8 @@ interface Blank extends WithPolicyDefinitions { interface WithPolicyDefinitions { /** * Specifies policyDefinitions. + * @param policyDefinitions An array of policy definition references + * @return the next definition stage */ WithCreate withPolicyDefinitions(List policyDefinitions); } @@ -100,6 +102,8 @@ interface WithPolicyDefinitions { interface WithDescription { /** * Specifies description. + * @param description The policy set definition description + * @return the next definition stage */ WithCreate withDescription(String description); } @@ -110,6 +114,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next definition stage */ WithCreate withDisplayName(String displayName); } @@ -120,6 +126,8 @@ interface WithDisplayName { interface WithMetadata { /** * Specifies metadata. + * @param metadata The policy set definition metadata + * @return the next definition stage */ WithCreate withMetadata(Object metadata); } @@ -130,6 +138,8 @@ interface WithMetadata { interface WithParameters { /** * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next definition stage */ WithCreate withParameters(Object parameters); } @@ -140,6 +150,8 @@ interface WithParameters { interface WithPolicyType { /** * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next definition stage */ WithCreate withPolicyType(PolicyType policyType); } @@ -168,6 +180,8 @@ interface UpdateStages { interface WithDescription { /** * Specifies description. + * @param description The policy set definition description + * @return the next update stage */ Update withDescription(String description); } @@ -178,6 +192,8 @@ interface WithDescription { interface WithDisplayName { /** * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next update stage */ Update withDisplayName(String displayName); } @@ -188,6 +204,8 @@ interface WithDisplayName { interface WithMetadata { /** * Specifies metadata. + * @param metadata The policy set definition metadata + * @return the next update stage */ Update withMetadata(Object metadata); } @@ -198,6 +216,8 @@ interface WithMetadata { interface WithParameters { /** * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next update stage */ Update withParameters(Object parameters); } @@ -208,6 +228,8 @@ interface WithParameters { interface WithPolicyType { /** * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next update stage */ Update withPolicyType(PolicyType policyType); } diff --git a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicyAssignmentImpl.java b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicyAssignmentImpl.java index e443c60f4f580..c9f7593597121 100644 --- a/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicyAssignmentImpl.java +++ b/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicyAssignmentImpl.java @@ -33,10 +33,10 @@ class PolicyAssignmentImpl extends CreatableUpdatableImpl + + 4.0.0 + com.microsoft.azure.policy.v2018_05_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-policy + 1.0.0-beta + jar + Microsoft Azure SDK for Authorization Management + This package contains Microsoft Authorization 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 + + + + + + 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/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponse.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponse.java new file mode 100644 index 0000000000000..fd611e675be18 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponse.java @@ -0,0 +1,96 @@ +/** + * 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.policy.v2018_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates Azure Resource Manager is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * Http status code. + */ + @JsonProperty(value = "httpStatus") + private String httpStatus; + + /** + * Error code. + */ + @JsonProperty(value = "errorCode") + private String errorCode; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /** + * Get http status code. + * + * @return the httpStatus value + */ + public String httpStatus() { + return this.httpStatus; + } + + /** + * Set http status code. + * + * @param httpStatus the httpStatus value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withHttpStatus(String httpStatus) { + this.httpStatus = httpStatus; + return this; + } + + /** + * Get error code. + * + * @return the errorCode value + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set error code. + * + * @param errorCode the errorCode value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set error message indicating why the operation failed. + * + * @param errorMessage the errorMessage value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponseException.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponseException.java new file mode 100644 index 0000000000000..3776457c06b15 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ErrorResponseException.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.policy.v2018_05_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException 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 ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/Identity.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/Identity.java new file mode 100644 index 0000000000000..216acc1e31b5c --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/Identity.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2018_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of the resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of the resource identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'SystemAssigned', 'None'. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principal ID of the resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of the resource identity. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignment.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignment.java new file mode 100644 index 0000000000000..d9a64c840e511 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignment.java @@ -0,0 +1,378 @@ +/** + * 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.policy.v2018_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyAssignmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyManager; +import java.util.List; + +/** + * Type representing PolicyAssignment. + */ +public interface PolicyAssignment extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notScopes value. + */ + List notScopes(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the scopeProperty value. + */ + String scopeProperty(); + + /** + * @return the sku value. + */ + PolicySku sku(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicyAssignment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyAssignment definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the policyassignment definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @return the next definition stage + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the policyassignment definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policyassignment definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policyassignment definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The managed identity associated with the policy assignment + * @return the next definition stage + */ + WithCreate withIdentity(Identity identity); + } + + /** + * The stage of the policyassignment definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the policy assignment. Only required when utilizing managed identity + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the policyassignment definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy assignment metadata + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policyassignment definition allowing to specify NotScopes. + */ + interface WithNotScopes { + /** + * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next definition stage + */ + WithCreate withNotScopes(List notScopes); + } + + /** + * The stage of the policyassignment definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage + */ + WithCreate withParameters(Object parameters); + } + + /** + * The stage of the policyassignment definition allowing to specify PolicyDefinitionId. + */ + interface WithPolicyDefinitionId { + /** + * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next definition stage + */ + WithCreate withPolicyDefinitionId(String policyDefinitionId); + } + + /** + * The stage of the policyassignment definition allowing to specify ScopeProperty. + */ + interface WithScopeProperty { + /** + * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next definition stage + */ + WithCreate withScopeProperty(String scopeProperty); + } + + /** + * The stage of the policyassignment definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next definition stage + */ + WithCreate withSku(PolicySku sku); + } + + /** + * 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.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithIdentity, DefinitionStages.WithLocation, DefinitionStages.WithMetadata, DefinitionStages.WithNotScopes, DefinitionStages.WithParameters, DefinitionStages.WithPolicyDefinitionId, DefinitionStages.WithScopeProperty, DefinitionStages.WithSku { + } + } + /** + * The template for a PolicyAssignment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithIdentity, UpdateStages.WithLocation, UpdateStages.WithMetadata, UpdateStages.WithNotScopes, UpdateStages.WithParameters, UpdateStages.WithPolicyDefinitionId, UpdateStages.WithScopeProperty, UpdateStages.WithSku { + } + + /** + * Grouping of PolicyAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the policyassignment update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policyassignment update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policyassignment update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The managed identity associated with the policy assignment + * @return the next update stage + */ + Update withIdentity(Identity identity); + } + + /** + * The stage of the policyassignment update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the policy assignment. Only required when utilizing managed identity + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the policyassignment update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy assignment metadata + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policyassignment update allowing to specify NotScopes. + */ + interface WithNotScopes { + /** + * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next update stage + */ + Update withNotScopes(List notScopes); + } + + /** + * The stage of the policyassignment update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage + */ + Update withParameters(Object parameters); + } + + /** + * The stage of the policyassignment update allowing to specify PolicyDefinitionId. + */ + interface WithPolicyDefinitionId { + /** + * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next update stage + */ + Update withPolicyDefinitionId(String policyDefinitionId); + } + + /** + * The stage of the policyassignment update allowing to specify ScopeProperty. + */ + interface WithScopeProperty { + /** + * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next update stage + */ + Update withScopeProperty(String scopeProperty); + } + + /** + * The stage of the policyassignment update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next update stage + */ + Update withSku(PolicySku sku); + } + + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignments.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignments.java new file mode 100644 index 0000000000000..f36db547c483e --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyAssignments.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2018_05_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyAssignmentInner; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicyAssignments. + */ +public interface PolicyAssignments extends SupportsCreating, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String scope, String policyAssignmentName); + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String scope, String policyAssignmentName); + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName); + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByIdAsync(String policyAssignmentId); + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters); + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String policyAssignmentId); + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinition.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinition.java new file mode 100644 index 0000000000000..19e13c043bf74 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinition.java @@ -0,0 +1,278 @@ +/** + * 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.policy.v2018_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyManager; + +/** + * Type representing PolicyDefinition. + */ +public interface PolicyDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the mode value. + */ + PolicyMode mode(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the policyRule value. + */ + Object policyRule(); + + /** + * @return the policyType value. + */ + PolicyType policyType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicyDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyDefinition definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the policydefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policydefinition definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policydefinition definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy definition metadata + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policydefinition definition allowing to specify Mode. + */ + interface WithMode { + /** + * Specifies mode. + * @param mode The policy definition mode. Possible values are NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', 'Indexed', 'All' + * @return the next definition stage + */ + WithCreate withMode(PolicyMode mode); + } + + /** + * The stage of the policydefinition definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage + */ + WithCreate withParameters(Object parameters); + } + + /** + * The stage of the policydefinition definition allowing to specify PolicyRule. + */ + interface WithPolicyRule { + /** + * Specifies policyRule. + * @param policyRule The policy rule + * @return the next definition stage + */ + WithCreate withPolicyRule(Object policyRule); + } + + /** + * The stage of the policydefinition definition allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next definition stage + */ + WithCreate withPolicyType(PolicyType policyType); + } + + /** + * 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.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadata, DefinitionStages.WithMode, DefinitionStages.WithParameters, DefinitionStages.WithPolicyRule, DefinitionStages.WithPolicyType { + } + } + /** + * The template for a PolicyDefinition update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMetadata, UpdateStages.WithMode, UpdateStages.WithParameters, UpdateStages.WithPolicyRule, UpdateStages.WithPolicyType { + } + + /** + * Grouping of PolicyDefinition update stages. + */ + interface UpdateStages { + /** + * The stage of the policydefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policydefinition update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policydefinition update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy definition metadata + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policydefinition update allowing to specify Mode. + */ + interface WithMode { + /** + * Specifies mode. + * @param mode The policy definition mode. Possible values are NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', 'Indexed', 'All' + * @return the next update stage + */ + Update withMode(PolicyMode mode); + } + + /** + * The stage of the policydefinition update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage + */ + Update withParameters(Object parameters); + } + + /** + * The stage of the policydefinition update allowing to specify PolicyRule. + */ + interface WithPolicyRule { + /** + * Specifies policyRule. + * @param policyRule The policy rule + * @return the next update stage + */ + Update withPolicyRule(Object policyRule); + } + + /** + * The stage of the policydefinition update allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next update stage + */ + Update withPolicyType(PolicyType policyType); + } + + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitionReference.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitionReference.java new file mode 100644 index 0000000000000..a5d065bef3a97 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitionReference.java @@ -0,0 +1,69 @@ +/** + * 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.policy.v2018_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy definition reference. + */ +public class PolicyDefinitionReference { + /** + * The ID of the policy definition or policy set definition. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Required if a parameter is used in policy rule. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Get the ID of the policy definition or policy set definition. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the ID of the policy definition or policy set definition. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get required if a parameter is used in policy rule. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set required if a parameter is used in policy rule. + * + * @param parameters the parameters value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitions.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitions.java new file mode 100644 index 0000000000000..3ae14f0851788 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyDefinitions.java @@ -0,0 +1,106 @@ +/** + * 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.policy.v2018_05_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyDefinitionInner; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicyDefinitions. + */ +public interface PolicyDefinitions extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String policyDefinitionName); + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String policyDefinitionName); + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBuiltInAsync(String policyDefinitionName); + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters); + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId); + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId); + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBuiltInAsync(); + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyMode.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyMode.java new file mode 100644 index 0000000000000..ae55d2ce4945c --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyMode.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.policy.v2018_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyMode. + */ +public final class PolicyMode extends ExpandableStringEnum { + /** Static value NotSpecified for PolicyMode. */ + public static final PolicyMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Indexed for PolicyMode. */ + public static final PolicyMode INDEXED = fromString("Indexed"); + + /** Static value All for PolicyMode. */ + public static final PolicyMode ALL = fromString("All"); + + /** + * Creates or finds a PolicyMode from its string representation. + * @param name a name to look for + * @return the corresponding PolicyMode + */ + @JsonCreator + public static PolicyMode fromString(String name) { + return fromString(name, PolicyMode.class); + } + + /** + * @return known PolicyMode values + */ + public static Collection values() { + return values(PolicyMode.class); + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinition.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinition.java new file mode 100644 index 0000000000000..cea1ab86a0616 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinition.java @@ -0,0 +1,238 @@ +/** + * 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.policy.v2018_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicySetDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicyManager; +import java.util.List; + +/** + * Type representing PolicySetDefinition. + */ +public interface PolicySetDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the policyDefinitions value. + */ + List policyDefinitions(); + + /** + * @return the policyType value. + */ + PolicyType policyType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicySetDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPolicyDefinitions, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicySetDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicySetDefinition definition. + */ + interface Blank extends WithPolicyDefinitions { + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyDefinitions. + */ + interface WithPolicyDefinitions { + /** + * Specifies policyDefinitions. + * @param policyDefinitions An array of policy definition references + * @return the next definition stage + */ + WithCreate withPolicyDefinitions(List policyDefinitions); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy set definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policysetdefinition definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy set definition metadata + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next definition stage + */ + WithCreate withParameters(Object parameters); + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next definition stage + */ + WithCreate withPolicyType(PolicyType policyType); + } + + /** + * 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.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadata, DefinitionStages.WithParameters, DefinitionStages.WithPolicyType { + } + } + /** + * The template for a PolicySetDefinition update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMetadata, UpdateStages.WithParameters, UpdateStages.WithPolicyType { + } + + /** + * Grouping of PolicySetDefinition update stages. + */ + interface UpdateStages { + /** + * The stage of the policysetdefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy set definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policysetdefinition update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policysetdefinition update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy set definition metadata + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policysetdefinition update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next update stage + */ + Update withParameters(Object parameters); + } + + /** + * The stage of the policysetdefinition update allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next update stage + */ + Update withPolicyType(PolicyType policyType); + } + + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinitions.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinitions.java new file mode 100644 index 0000000000000..d217d3b4ed6d5 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySetDefinitions.java @@ -0,0 +1,106 @@ +/** + * 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.policy.v2018_05_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicySetDefinitionInner; +import com.microsoft.azure.management.policy.v2018_05_01.implementation.PolicySetDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicySetDefinitions. + */ +public interface PolicySetDefinitions extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String policySetDefinitionName); + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String policySetDefinitionName); + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBuiltInAsync(String policySetDefinitionName); + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters); + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId); + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId); + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBuiltInAsync(); + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySku.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySku.java new file mode 100644 index 0000000000000..2deb4e8148520 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicySku.java @@ -0,0 +1,69 @@ +/** + * 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.policy.v2018_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy sku. This property is optional, obsolete, and will be ignored. + */ +public class PolicySku { + /** + * The name of the policy sku. Possible values are A0 and A1. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The policy sku tier. Possible values are Free and Standard. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * Get the name of the policy sku. Possible values are A0 and A1. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the policy sku. Possible values are A0 and A1. + * + * @param name the name value to set + * @return the PolicySku object itself. + */ + public PolicySku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the policy sku tier. Possible values are Free and Standard. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the policy sku tier. Possible values are Free and Standard. + * + * @param tier the tier value to set + * @return the PolicySku object itself. + */ + public PolicySku withTier(String tier) { + this.tier = tier; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyType.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyType.java new file mode 100644 index 0000000000000..1e66edc8821e5 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/PolicyType.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.policy.v2018_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyType. + */ +public final class PolicyType extends ExpandableStringEnum { + /** Static value NotSpecified for PolicyType. */ + public static final PolicyType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value BuiltIn for PolicyType. */ + public static final PolicyType BUILT_IN = fromString("BuiltIn"); + + /** Static value Custom for PolicyType. */ + public static final PolicyType CUSTOM = fromString("Custom"); + + /** + * Creates or finds a PolicyType from its string representation. + * @param name a name to look for + * @return the corresponding PolicyType + */ + @JsonCreator + public static PolicyType fromString(String name) { + return fromString(name, PolicyType.class); + } + + /** + * @return known PolicyType values + */ + public static Collection values() { + return values(PolicyType.class); + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ResourceIdentityType.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ResourceIdentityType.java new file mode 100644 index 0000000000000..197ef162980c1 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/ResourceIdentityType.java @@ -0,0 +1,53 @@ +/** + * 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.policy.v2018_05_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/IdParsingUtils.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..f1aa3793a6d2a --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/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.policy.v2018_05_01.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/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PageImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..3424f793e0102 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/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.policy.v2018_05_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("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/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentImpl.java new file mode 100644 index 0000000000000..e18041658250a --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentImpl.java @@ -0,0 +1,205 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import com.microsoft.azure.management.policy.v2018_05_01.PolicyAssignment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.policy.v2018_05_01.PolicySku; +import com.microsoft.azure.management.policy.v2018_05_01.Identity; + +class PolicyAssignmentImpl extends CreatableUpdatableImpl implements PolicyAssignment, PolicyAssignment.Definition, PolicyAssignment.Update { + private String scope; + private String policyAssignmentName; + private final PolicyManager manager; + + PolicyAssignmentImpl(String name, PolicyManager manager) { + super(name, new PolicyAssignmentInner()); + this.manager = manager; + // Set resource name + this.policyAssignmentName = name; + // + } + + PolicyAssignmentImpl(PolicyAssignmentInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policyAssignmentName = inner.name(); + // set resource ancestor and positional variables + this.policyAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "policyAssignments"); + this.scope = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.createAsync(this.scope, this.policyAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.createAsync(this.scope, this.policyAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.getAsync(this.scope, this.policyAssignmentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List notScopes() { + return this.inner().notScopes(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public String policyDefinitionId() { + return this.inner().policyDefinitionId(); + } + + @Override + public String scopeProperty() { + return this.inner().scopeProperty(); + } + + @Override + public PolicySku sku() { + return this.inner().sku(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyAssignmentImpl withScope(String scope) { + this.scope = scope; + return this; + } + + @Override + public PolicyAssignmentImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyAssignmentImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicyAssignmentImpl withIdentity(Identity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public PolicyAssignmentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public PolicyAssignmentImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicyAssignmentImpl withNotScopes(List notScopes) { + this.inner().withNotScopes(notScopes); + return this; + } + + @Override + public PolicyAssignmentImpl withParameters(Object parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicyAssignmentImpl withPolicyDefinitionId(String policyDefinitionId) { + this.inner().withPolicyDefinitionId(policyDefinitionId); + return this; + } + + @Override + public PolicyAssignmentImpl withScopeProperty(String scopeProperty) { + this.inner().withScopeProperty(scopeProperty); + return this; + } + + @Override + public PolicyAssignmentImpl withSku(PolicySku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentInner.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentInner.java new file mode 100644 index 0000000000000..f52dd497cf45f --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentInner.java @@ -0,0 +1,285 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.policy.v2018_05_01.PolicySku; +import com.microsoft.azure.management.policy.v2018_05_01.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy assignment. + */ +@JsonFlatten +public class PolicyAssignmentInner extends ProxyResource { + /** + * The display name of the policy assignment. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The ID of the policy definition or policy set definition being assigned. + */ + @JsonProperty(value = "properties.policyDefinitionId") + private String policyDefinitionId; + + /** + * The scope for the policy assignment. + */ + @JsonProperty(value = "properties.scope") + private String scopeProperty; + + /** + * The policy's excluded scopes. + */ + @JsonProperty(value = "properties.notScopes") + private List notScopes; + + /** + * Required if a parameter is used in policy rule. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * This message will be part of response in case of policy violation. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy assignment metadata. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The policy sku. This property is optional, obsolete, and will be + * ignored. + */ + @JsonProperty(value = "sku") + private PolicySku sku; + + /** + * The location of the policy assignment. Only required when utilizing + * managed identity. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The managed identity associated with the policy assignment. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the display name of the policy assignment. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy assignment. + * + * @param displayName the displayName value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the ID of the policy definition or policy set definition being assigned. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the ID of the policy definition or policy set definition being assigned. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the scope for the policy assignment. + * + * @return the scopeProperty value + */ + public String scopeProperty() { + return this.scopeProperty; + } + + /** + * Set the scope for the policy assignment. + * + * @param scopeProperty the scopeProperty value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withScopeProperty(String scopeProperty) { + this.scopeProperty = scopeProperty; + return this; + } + + /** + * Get the policy's excluded scopes. + * + * @return the notScopes value + */ + public List notScopes() { + return this.notScopes; + } + + /** + * Set the policy's excluded scopes. + * + * @param notScopes the notScopes value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withNotScopes(List notScopes) { + this.notScopes = notScopes; + return this; + } + + /** + * Get required if a parameter is used in policy rule. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set required if a parameter is used in policy rule. + * + * @param parameters the parameters value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get this message will be part of response in case of policy violation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set this message will be part of response in case of policy violation. + * + * @param description the description value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy assignment metadata. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy assignment metadata. + * + * @param metadata the metadata value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the policy sku. This property is optional, obsolete, and will be ignored. + * + * @return the sku value + */ + public PolicySku sku() { + return this.sku; + } + + /** + * Set the policy sku. This property is optional, obsolete, and will be ignored. + * + * @param sku the sku value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withSku(PolicySku sku) { + this.sku = sku; + return this; + } + + /** + * Get the location of the policy assignment. Only required when utilizing managed identity. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the policy assignment. Only required when utilizing managed identity. + * + * @param location the location value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the managed identity associated with the policy assignment. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the managed identity associated with the policy assignment. + * + * @param identity the identity value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsImpl.java new file mode 100644 index 0000000000000..6477daabe945c --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsImpl.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2018_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyAssignments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyAssignment; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicyAssignmentsImpl extends WrapperImpl implements PolicyAssignments { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicyAssignmentsImpl(PolicyManager manager) { + super(manager.inner().policyAssignments()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicyAssignmentInner inner) { + return Observable.just((PolicyAssignment) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicyAssignmentImpl define(String name) { + return wrapModel(name); + } + + private PolicyAssignmentImpl wrapModel(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + + private PolicyAssignmentImpl wrapModel(String name) { + return new PolicyAssignmentImpl(name, this.manager()); + } + + @Override + public Observable deleteAsync(String scope, String policyAssignmentName) { + PolicyAssignmentsInner client = this.inner(); + return client.deleteAsync(scope, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String scope, String policyAssignmentName) { + PolicyAssignmentsInner client = this.inner(); + return client.getAsync(scope, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + PolicyAssignmentsInner client = this.inner(); + return client.listForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByIdAsync(String policyAssignmentId) { + PolicyAssignmentsInner client = this.inner(); + return client.deleteByIdAsync(policyAssignmentId) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + PolicyAssignmentsInner client = this.inner(); + return client.createByIdAsync(policyAssignmentId, parameters) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String policyAssignmentId) { + PolicyAssignmentsInner client = this.inner(); + return client.getByIdAsync(policyAssignmentId) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicyAssignmentsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicyAssignmentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + PolicyAssignmentsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + PolicyAssignmentsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsInner.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsInner.java new file mode 100644 index 0000000000000..f7106d25d246a --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyAssignmentsInner.java @@ -0,0 +1,1748 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.policy.v2018_05_01.ErrorResponseException; +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.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyAssignments. + */ +public class PolicyAssignmentsInner implements InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private PolicyAssignmentsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicyAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyAssignmentsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicyAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicyAssignments delete" }) + @HTTP(path = "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @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.policy.v2018_05_01.PolicyAssignments create" }) + @PUT("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + Observable> create(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Body PolicyAssignmentInner parameters, @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.policy.v2018_05_01.PolicyAssignments get" }) + @GET("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @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.policy.v2018_05_01.PolicyAssignments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query(value = "$filter", encoded = true) String filter, @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.policy.v2018_05_01.PolicyAssignments listForResource" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments") + Observable> listForResource(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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.policy.v2018_05_01.PolicyAssignments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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.policy.v2018_05_01.PolicyAssignments deleteById" }) + @HTTP(path = "{policyAssignmentId}", method = "DELETE", hasBody = true) + Observable> deleteById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @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.policy.v2018_05_01.PolicyAssignments createById" }) + @PUT("{policyAssignmentId}") + Observable> createById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Body PolicyAssignmentInner parameters, @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.policy.v2018_05_01.PolicyAssignments getById" }) + @GET("{policyAssignmentId}") + Observable> getById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @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.policy.v2018_05_01.PolicyAssignments listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @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.policy.v2018_05_01.PolicyAssignments listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @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.policy.v2018_05_01.PolicyAssignments listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner delete(String scope, String policyAssignmentName) { + return deleteWithServiceResponseAsync(scope, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @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 scope, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(scope, policyAssignmentName), serviceCallback); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable deleteAsync(String scope, String policyAssignmentName) { + return deleteWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> deleteWithServiceResponseAsync(String scope, String policyAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName 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(scope, policyAssignmentName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner create(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + return createWithServiceResponseAsync(scope, policyAssignmentName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @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 createAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(scope, policyAssignmentName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable createAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + return createWithServiceResponseAsync(scope, policyAssignmentName, parameters).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> createWithServiceResponseAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.create(scope, policyAssignmentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner get(String scope, String policyAssignmentName) { + return getWithServiceResponseAsync(scope, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @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 scope, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, policyAssignmentName), serviceCallback); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable getAsync(String scope, String policyAssignmentName) { + return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> getWithServiceResponseAsync(String scope, String policyAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName 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(scope, policyAssignmentName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @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> listByResourceGroupAsync(final String resourceGroupName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains policy assignments. + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @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> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.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."); + } + final String filter = null; + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @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> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + ServiceResponse> * @param resourceGroupName The name of the resource group containing the resource. + ServiceResponse> * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + ServiceResponse> * @param parentResourcePath The parent resource path. Use empty string if there is none. + ServiceResponse> * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + ServiceResponse> * @param resourceName The name of the resource. + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.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.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @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 String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + 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(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner deleteById(String policyAssignmentId) { + return deleteByIdWithServiceResponseAsync(policyAssignmentId).toBlocking().single().body(); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @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 deleteByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(policyAssignmentId), serviceCallback); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable deleteByIdAsync(String policyAssignmentId) { + return deleteByIdWithServiceResponseAsync(policyAssignmentId).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> deleteByIdWithServiceResponseAsync(String policyAssignmentId) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId 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.deleteById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner createById(String policyAssignmentId, PolicyAssignmentInner parameters) { + return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @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 createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(policyAssignmentId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> createByIdWithServiceResponseAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createById(policyAssignmentId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner getById(String policyAssignmentId) { + return getByIdWithServiceResponseAsync(policyAssignmentId).toBlocking().single().body(); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @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 getByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(policyAssignmentId), serviceCallback); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable getByIdAsync(String policyAssignmentId) { + return getByIdWithServiceResponseAsync(policyAssignmentId).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> getByIdWithServiceResponseAsync(String policyAssignmentId) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId 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.getById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource group and assign the policy definition whose id is {value}. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResourceNext(final String nextPageLink) { + ServiceResponse> response = listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the resource and assign the policy definition whose id is {value}. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes only policy assignments that apply to the subscription and assign the policy definition whose id is {value}. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyClientImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyClientImpl.java new file mode 100644 index 0000000000000..1bf9de38bfcdc --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyClientImpl.java @@ -0,0 +1,224 @@ +/** + * 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.policy.v2018_05_01.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 PolicyClientImpl class. + */ +public class PolicyClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public PolicyClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @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 PolicyClientImpl 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 PolicyClientImpl 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 PolicyClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PolicyAssignmentsInner object to access its operations. + */ + private PolicyAssignmentsInner policyAssignments; + + /** + * Gets the PolicyAssignmentsInner object to access its operations. + * @return the PolicyAssignmentsInner object. + */ + public PolicyAssignmentsInner policyAssignments() { + return this.policyAssignments; + } + + /** + * The PolicyDefinitionsInner object to access its operations. + */ + private PolicyDefinitionsInner policyDefinitions; + + /** + * Gets the PolicyDefinitionsInner object to access its operations. + * @return the PolicyDefinitionsInner object. + */ + public PolicyDefinitionsInner policyDefinitions() { + return this.policyDefinitions; + } + + /** + * The PolicySetDefinitionsInner object to access its operations. + */ + private PolicySetDefinitionsInner policySetDefinitions; + + /** + * Gets the PolicySetDefinitionsInner object to access its operations. + * @return the PolicySetDefinitionsInner object. + */ + public PolicySetDefinitionsInner policySetDefinitions() { + return this.policySetDefinitions; + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param credentials the management credentials for Azure + */ + public PolicyClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public PolicyClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public PolicyClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-05-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.policyAssignments = new PolicyAssignmentsInner(restClient().retrofit(), this); + this.policyDefinitions = new PolicyDefinitionsInner(restClient().retrofit(), this); + this.policySetDefinitions = new PolicySetDefinitionsInner(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(), "PolicyClient", "2018-05-01"); + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionImpl.java new file mode 100644 index 0000000000000..0a468c64306ac --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionImpl.java @@ -0,0 +1,163 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyType; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyMode; + +class PolicyDefinitionImpl extends CreatableUpdatableImpl implements PolicyDefinition, PolicyDefinition.Definition, PolicyDefinition.Update { + private String policyDefinitionName; + private final PolicyManager manager; + + PolicyDefinitionImpl(String name, PolicyManager manager) { + super(name, new PolicyDefinitionInner()); + this.manager = manager; + // Set resource name + this.policyDefinitionName = name; + // + } + + PolicyDefinitionImpl(PolicyDefinitionInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policyDefinitionName = inner.name(); + // set resource ancestor and positional variables + this.policyDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "policyDefinitions"); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.createOrUpdateAsync(this.policyDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.createOrUpdateAsync(this.policyDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.getAsync(this.policyDefinitionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public PolicyMode mode() { + return this.inner().mode(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public Object policyRule() { + return this.inner().policyRule(); + } + + @Override + public PolicyType policyType() { + return this.inner().policyType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyDefinitionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicyDefinitionImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicyDefinitionImpl withMode(PolicyMode mode) { + this.inner().withMode(mode); + return this; + } + + @Override + public PolicyDefinitionImpl withParameters(Object parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicyDefinitionImpl withPolicyRule(Object policyRule) { + this.inner().withPolicyRule(policyRule); + return this; + } + + @Override + public PolicyDefinitionImpl withPolicyType(PolicyType policyType) { + this.inner().withPolicyType(policyType); + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionInner.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionInner.java new file mode 100644 index 0000000000000..48a1f69bef9f5 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionInner.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2018_05_01.implementation; + +import com.microsoft.azure.management.policy.v2018_05_01.PolicyType; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy definition. + */ +@JsonFlatten +public class PolicyDefinitionInner extends ProxyResource { + /** + * The type of policy definition. Possible values are NotSpecified, + * BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', + * 'Custom'. + */ + @JsonProperty(value = "properties.policyType") + private PolicyType policyType; + + /** + * The policy definition mode. Possible values are NotSpecified, Indexed, + * and All. Possible values include: 'NotSpecified', 'Indexed', 'All'. + */ + @JsonProperty(value = "properties.mode") + private PolicyMode mode; + + /** + * The display name of the policy definition. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The policy definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy rule. + */ + @JsonProperty(value = "properties.policyRule") + private Object policyRule; + + /** + * The policy definition metadata. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * Required if a parameter is used in policy rule. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * Get the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @return the policyType value + */ + public PolicyType policyType() { + return this.policyType; + } + + /** + * Set the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @param policyType the policyType value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withPolicyType(PolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Get the policy definition mode. Possible values are NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', 'Indexed', 'All'. + * + * @return the mode value + */ + public PolicyMode mode() { + return this.mode; + } + + /** + * Set the policy definition mode. Possible values are NotSpecified, Indexed, and All. Possible values include: 'NotSpecified', 'Indexed', 'All'. + * + * @param mode the mode value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withMode(PolicyMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the display name of the policy definition. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy definition. + * + * @param displayName the displayName value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policy definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the policy definition description. + * + * @param description the description value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy rule. + * + * @return the policyRule value + */ + public Object policyRule() { + return this.policyRule; + } + + /** + * Set the policy rule. + * + * @param policyRule the policyRule value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withPolicyRule(Object policyRule) { + this.policyRule = policyRule; + return this; + } + + /** + * Get the policy definition metadata. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy definition metadata. + * + * @param metadata the metadata value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get required if a parameter is used in policy rule. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set required if a parameter is used in policy rule. + * + * @param parameters the parameters value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsImpl.java new file mode 100644 index 0000000000000..5eaf126eba6a1 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsImpl.java @@ -0,0 +1,174 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.policy.v2018_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinition; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicyDefinitionsImpl extends WrapperImpl implements PolicyDefinitions { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicyDefinitionsImpl(PolicyManager manager) { + super(manager.inner().policyDefinitions()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicyDefinitionInner inner) { + return Observable.just((PolicyDefinition) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicyDefinitionImpl define(String name) { + return wrapModel(name); + } + + private PolicyDefinitionImpl wrapModel(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + + private PolicyDefinitionImpl wrapModel(String name) { + return new PolicyDefinitionImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.deleteAsync(policyDefinitionName).toCompletable(); + } + + @Override + public Observable getAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.getAsync(policyDefinitionName) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBuiltInAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.getBuiltInAsync(policyDefinitionName) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + PolicyDefinitionsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupAsync(policyDefinitionName, managementGroupId, parameters) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(policyDefinitionName, managementGroupId).toCompletable(); + } + + @Override + public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.getAtManagementGroupAsync(policyDefinitionName, managementGroupId) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBuiltInAsync() { + PolicyDefinitionsInner client = this.inner(); + return client.listBuiltInAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicyDefinitionsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicyDefinitionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsInner.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsInner.java new file mode 100644 index 0000000000000..e6928d9736053 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyDefinitionsInner.java @@ -0,0 +1,1410 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyDefinitions. + */ +public class PolicyDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private PolicyDefinitionsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicyDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicyDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> createOrUpdate(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicyDefinitionInner parameters, @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.policy.v2018_05_01.PolicyDefinitions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitions get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> get(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitions getBuiltIn" }) + @GET("providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> getBuiltIn(@Path("policyDefinitionName") String policyDefinitionName, @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.policy.v2018_05_01.PolicyDefinitions createOrUpdateAtManagementGroup" }) + @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> createOrUpdateAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicyDefinitionInner parameters, @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.policy.v2018_05_01.PolicyDefinitions deleteAtManagementGroup" }) + @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @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.policy.v2018_05_01.PolicyDefinitions getAtManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> getAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @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.policy.v2018_05_01.PolicyDefinitions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitions listBuiltIn" }) + @GET("providers/Microsoft.Authorization/policyDefinitions") + Observable> listBuiltIn(@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.policy.v2018_05_01.PolicyDefinitions listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @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.policy.v2018_05_01.PolicyDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.policy.v2018_05_01.PolicyDefinitions listBuiltInNext" }) + @GET + Observable> listBuiltInNext(@Url String nextUrl, @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.policy.v2018_05_01.PolicyDefinitions listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @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 PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner createOrUpdate(String policyDefinitionName, PolicyDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @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 policyDefinitionName, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createOrUpdate(policyDefinitionName, this.client.subscriptionId(), parameters, 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(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @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 + */ + public void delete(String policyDefinitionName) { + deleteWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @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 policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String policyDefinitionName) { + return deleteWithServiceResponseAsync(policyDefinitionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policyDefinitionName, this.client.subscriptionId(), 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @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 PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner get(String policyDefinitionName) { + return getWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @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 policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getAsync(String policyDefinitionName) { + return getWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policyDefinitionName, this.client.subscriptionId(), 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); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @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 PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner getBuiltIn(String policyDefinitionName) { + return getBuiltInWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @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 getBuiltInAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getBuiltInAsync(String policyDefinitionName) { + return getBuiltInWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getBuiltInWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName 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.getBuiltIn(policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBuiltInDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBuiltInDelegate(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); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @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 PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner createOrUpdateAtManagementGroup(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @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 createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createOrUpdateAtManagementGroup(policyDefinitionName, managementGroupId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @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 + */ + public void deleteAtManagementGroup(String policyDefinitionName, String managementGroupId) { + deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @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 deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + return deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.deleteAtManagementGroup(policyDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @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 PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner getAtManagementGroup(String policyDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @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 getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.getAtManagementGroup(policyDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(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); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @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 PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @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 PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listBuiltIn() { + ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @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> listBuiltInAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listBuiltInAsync() { + return listBuiltInWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listBuiltInWithServiceResponseAsync() { + return listBuiltInSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBuiltIn(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInDelegate(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); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @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 PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @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> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + ServiceResponse> * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.listByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(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); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listBuiltInNext(final String nextPageLink) { + ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listBuiltInNextAsync(final String nextPageLink) { + return listBuiltInNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInNextDelegate(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); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(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/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyManager.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyManager.java new file mode 100644 index 0000000000000..470260f1770d1 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicyManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2018_05_01.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.policy.v2018_05_01.PolicyAssignments; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitions; +import com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinitions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Authorization resource management. + */ +public final class PolicyManager extends ManagerCore { + private PolicyAssignments policyAssignments; + private PolicyDefinitions policyDefinitions; + private PolicySetDefinitions policySetDefinitions; + /** + * Get a Configurable instance that can be used to create PolicyManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new PolicyManager.ConfigurableImpl(); + } + /** + * Creates an instance of PolicyManager that exposes Authorization resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the PolicyManager + */ + public static PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new PolicyManager(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 PolicyManager that exposes Authorization resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the PolicyManager + */ + public static PolicyManager authenticate(RestClient restClient, String subscriptionId) { + return new PolicyManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of PolicyManager that exposes Authorization management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Authorization management API entry points that work across subscriptions + */ + PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage PolicyAssignments. + */ + public PolicyAssignments policyAssignments() { + if (this.policyAssignments == null) { + this.policyAssignments = new PolicyAssignmentsImpl(this); + } + return this.policyAssignments; + } + + /** + * @return Entry point to manage PolicyDefinitions. + */ + public PolicyDefinitions policyDefinitions() { + if (this.policyDefinitions == null) { + this.policyDefinitions = new PolicyDefinitionsImpl(this); + } + return this.policyDefinitions; + } + + /** + * @return Entry point to manage PolicySetDefinitions. + */ + public PolicySetDefinitions policySetDefinitions() { + if (this.policySetDefinitions == null) { + this.policySetDefinitions = new PolicySetDefinitionsImpl(this); + } + return this.policySetDefinitions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return PolicyManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private PolicyManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new PolicyClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionImpl.java new file mode 100644 index 0000000000000..f273d966c70f4 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionImpl.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.policy.v2018_05_01.implementation; + +import com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyType; +import java.util.List; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitionReference; + +class PolicySetDefinitionImpl extends CreatableUpdatableImpl implements PolicySetDefinition, PolicySetDefinition.Definition, PolicySetDefinition.Update { + private String policySetDefinitionName; + private final PolicyManager manager; + + PolicySetDefinitionImpl(String name, PolicyManager manager) { + super(name, new PolicySetDefinitionInner()); + this.manager = manager; + // Set resource name + this.policySetDefinitionName = name; + // + } + + PolicySetDefinitionImpl(PolicySetDefinitionInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policySetDefinitionName = inner.name(); + // set resource ancestor and positional variables + this.policySetDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "policySetDefinitions"); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.createOrUpdateAsync(this.policySetDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.createOrUpdateAsync(this.policySetDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.getAsync(this.policySetDefinitionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public List policyDefinitions() { + return this.inner().policyDefinitions(); + } + + @Override + public PolicyType policyType() { + return this.inner().policyType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicySetDefinitionImpl withPolicyDefinitions(List policyDefinitions) { + this.inner().withPolicyDefinitions(policyDefinitions); + return this; + } + + @Override + public PolicySetDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicySetDefinitionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicySetDefinitionImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicySetDefinitionImpl withParameters(Object parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicySetDefinitionImpl withPolicyType(PolicyType policyType) { + this.inner().withPolicyType(policyType); + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionInner.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionInner.java new file mode 100644 index 0000000000000..e735b4d10897a --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionInner.java @@ -0,0 +1,182 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import com.microsoft.azure.management.policy.v2018_05_01.PolicyType; +import java.util.List; +import com.microsoft.azure.management.policy.v2018_05_01.PolicyDefinitionReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy set definition. + */ +@JsonFlatten +public class PolicySetDefinitionInner extends ProxyResource { + /** + * The type of policy definition. Possible values are NotSpecified, + * BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', + * 'Custom'. + */ + @JsonProperty(value = "properties.policyType") + private PolicyType policyType; + + /** + * The display name of the policy set definition. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The policy set definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy set definition metadata. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The policy set definition parameters that can be used in policy + * definition references. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * An array of policy definition references. + */ + @JsonProperty(value = "properties.policyDefinitions", required = true) + private List policyDefinitions; + + /** + * Get the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @return the policyType value + */ + public PolicyType policyType() { + return this.policyType; + } + + /** + * Set the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @param policyType the policyType value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyType(PolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Get the display name of the policy set definition. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy set definition. + * + * @param displayName the displayName value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policy set definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the policy set definition description. + * + * @param description the description value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy set definition metadata. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy set definition metadata. + * + * @param metadata the metadata value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the policy set definition parameters that can be used in policy definition references. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the policy set definition parameters that can be used in policy definition references. + * + * @param parameters the parameters value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get an array of policy definition references. + * + * @return the policyDefinitions value + */ + public List policyDefinitions() { + return this.policyDefinitions; + } + + /** + * Set an array of policy definition references. + * + * @param policyDefinitions the policyDefinitions value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyDefinitions(List policyDefinitions) { + this.policyDefinitions = policyDefinitions; + return this; + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsImpl.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsImpl.java new file mode 100644 index 0000000000000..d19444dd8056c --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsImpl.java @@ -0,0 +1,174 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.policy.v2018_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinition; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicySetDefinitionsImpl extends WrapperImpl implements PolicySetDefinitions { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicySetDefinitionsImpl(PolicyManager manager) { + super(manager.inner().policySetDefinitions()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicySetDefinitionInner inner) { + return Observable.just((PolicySetDefinition) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicySetDefinitionImpl define(String name) { + return wrapModel(name); + } + + private PolicySetDefinitionImpl wrapModel(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + + private PolicySetDefinitionImpl wrapModel(String name) { + return new PolicySetDefinitionImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.deleteAsync(policySetDefinitionName).toCompletable(); + } + + @Override + public Observable getAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.getAsync(policySetDefinitionName) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBuiltInAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.getBuiltInAsync(policySetDefinitionName) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + PolicySetDefinitionsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupAsync(policySetDefinitionName, managementGroupId, parameters) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(policySetDefinitionName, managementGroupId).toCompletable(); + } + + @Override + public Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.getAtManagementGroupAsync(policySetDefinitionName, managementGroupId) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBuiltInAsync() { + PolicySetDefinitionsInner client = this.inner(); + return client.listBuiltInAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicySetDefinitionsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicySetDefinitionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsInner.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsInner.java new file mode 100644 index 0000000000000..9aab871910ecb --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/PolicySetDefinitionsInner.java @@ -0,0 +1,1412 @@ +/** + * 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.policy.v2018_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.policy.v2018_05_01.ErrorResponseException; +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.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicySetDefinitions. + */ +public class PolicySetDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private PolicySetDefinitionsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicySetDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicySetDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicySetDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicySetDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicySetDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinitions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> createOrUpdate(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicySetDefinitionInner parameters, @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.policy.v2018_05_01.PolicySetDefinitions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinitions get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> get(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinitions getBuiltIn" }) + @GET("providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> getBuiltIn(@Path("policySetDefinitionName") String policySetDefinitionName, @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.policy.v2018_05_01.PolicySetDefinitions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2018_05_01.PolicySetDefinitions listBuiltIn" }) + @GET("providers/Microsoft.Authorization/policySetDefinitions") + Observable> listBuiltIn(@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.policy.v2018_05_01.PolicySetDefinitions createOrUpdateAtManagementGroup" }) + @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> createOrUpdateAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicySetDefinitionInner parameters, @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.policy.v2018_05_01.PolicySetDefinitions deleteAtManagementGroup" }) + @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @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.policy.v2018_05_01.PolicySetDefinitions getAtManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> getAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @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.policy.v2018_05_01.PolicySetDefinitions listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @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.policy.v2018_05_01.PolicySetDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.policy.v2018_05_01.PolicySetDefinitions listBuiltInNext" }) + @GET + Observable> listBuiltInNext(@Url String nextUrl, @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.policy.v2018_05_01.PolicySetDefinitions listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @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 policySetDefinitionName, PolicySetDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createOrUpdate(policySetDefinitionName, this.client.subscriptionId(), parameters, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String policySetDefinitionName) { + deleteWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @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 policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String policySetDefinitionName) { + return deleteWithServiceResponseAsync(policySetDefinitionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policySetDefinitionName, this.client.subscriptionId(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner get(String policySetDefinitionName) { + return getWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @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 policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getAsync(String policySetDefinitionName) { + return getWithServiceResponseAsync(policySetDefinitionName).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policySetDefinitionName, this.client.subscriptionId(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner getBuiltIn(String policySetDefinitionName) { + return getBuiltInWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @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 getBuiltInAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getBuiltInAsync(String policySetDefinitionName) { + return getBuiltInWithServiceResponseAsync(policySetDefinitionName).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getBuiltInWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName 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.getBuiltIn(policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBuiltInDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBuiltInDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listBuiltIn() { + ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @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> listBuiltInAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listBuiltInAsync() { + return listBuiltInWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listBuiltInWithServiceResponseAsync() { + return listBuiltInSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBuiltIn(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner createOrUpdateAtManagementGroup(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @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 createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createOrUpdateAtManagementGroup(policySetDefinitionName, managementGroupId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) { + deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @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 deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + return deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.deleteAtManagementGroup(policySetDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner getAtManagementGroup(String policySetDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @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 getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.getAtManagementGroup(policySetDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @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> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + ServiceResponse> * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.listByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listBuiltInNext(final String nextPageLink) { + ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listBuiltInNextAsync(final String nextPageLink) { + return listBuiltInNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/package-info.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/implementation/package-info.java new file mode 100644 index 0000000000000..fe917bebd5f14 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/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 PolicyClient. + * To manage and control access to your resources, you can define customized policies and assign them at a scope. + */ +package com.microsoft.azure.management.policy.v2018_05_01.implementation; diff --git a/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/package-info.java b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/package-info.java new file mode 100644 index 0000000000000..637ccbe97ca98 --- /dev/null +++ b/policy/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/policy/v2018_05_01/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 PolicyClient. + * To manage and control access to your resources, you can define customized policies and assign them at a scope. + */ +package com.microsoft.azure.management.policy.v2018_05_01; diff --git a/resources/resource-manager/v2016_06_01/pom.xml b/resources/resource-manager/v2016_06_01/pom.xml index d734835f4ed36..c2c6294885578 100644 --- a/resources/resource-manager/v2016_06_01/pom.xml +++ b/resources/resource-manager/v2016_06_01/pom.xml @@ -11,15 +11,15 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml - azure-mgmt-subscriptions + azure-mgmt-resources 1.0.0-beta jar - Microsoft Azure SDK for Management - This package contains Microsoft Management SDK. - https://github.com/Azure/azure-libraries-for-java + Microsoft Azure SDK for Resources Management + This package contains Microsoft Resources Management SDK. + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Location.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Location.java index df4a8a443b547..00dedf79b0be0 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Location.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Location.java @@ -11,12 +11,12 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.resources.v2016_06_01.implementation.LocationInner; import com.microsoft.azure.arm.resources.models.HasManager; -import com.microsoft.azure.management.resources.v2016_06_01.implementation.Manager; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.ResourcesManager; /** * Type representing Location. */ -public interface Location extends HasInner, HasManager { +public interface Location extends HasInner, HasManager { /** * @return the displayName value. */ diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operation.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operation.java new file mode 100644 index 0000000000000..f2c7d03aa6f18 --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operation.java @@ -0,0 +1,30 @@ +/** + * 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.resources.v2016_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/OperationDisplay.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/OperationDisplay.java new file mode 100644 index 0000000000000..bc8fe4a666864 --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/OperationDisplay.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.resources.v2016_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Resources. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.Resources. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Resources. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay 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 OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operations.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operations.java new file mode 100644 index 0000000000000..1ad07783bc392 --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.resources.v2016_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscription.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscription.java index c970233ba78ec..bb67055ccf7b0 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscription.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscription.java @@ -10,13 +10,13 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.HasManager; -import com.microsoft.azure.management.resources.v2016_06_01.implementation.Manager; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.ResourcesManager; import com.microsoft.azure.management.resources.v2016_06_01.implementation.SubscriptionInner; /** * Type representing Subscription. */ -public interface Subscription extends HasInner, HasManager { +public interface Subscription extends HasInner, HasManager { /** * @return the authorizationSource value. */ diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscriptions.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscriptions.java index f3b1f4685190e..6f1480cbdde73 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscriptions.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/Subscriptions.java @@ -8,10 +8,10 @@ package com.microsoft.azure.management.resources.v2016_06_01; -import com.microsoft.azure.PagedList; -import com.microsoft.azure.arm.model.HasInner; -import com.microsoft.azure.management.resources.v2016_06_01.implementation.SubscriptionsInner; import rx.Observable; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2016_06_01.Location; /** * Type representing Subscriptions. @@ -26,14 +26,6 @@ public interface Subscriptions extends HasInner { */ Observable getAsync(String subscriptionId); - /** - * Gets all subscriptions for a tenant. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - PagedList list(); - /** * Gets all subscriptions for a tenant. * diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/TenantIdDescription.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/TenantIdDescription.java index e4892daf5c036..b6cfdcae56121 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/TenantIdDescription.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/TenantIdDescription.java @@ -10,13 +10,13 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.HasManager; -import com.microsoft.azure.management.resources.v2016_06_01.implementation.Manager; +import com.microsoft.azure.management.resources.v2016_06_01.implementation.ResourcesManager; import com.microsoft.azure.management.resources.v2016_06_01.implementation.TenantIdDescriptionInner; /** * Type representing TenantIdDescription. */ -public interface TenantIdDescription extends HasInner, HasManager { +public interface TenantIdDescription extends HasInner, HasManager { /** * @return the id value. */ diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/LocationImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/LocationImpl.java index d8417d855de7a..b4dc5cf0ae0ba 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/LocationImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/LocationImpl.java @@ -13,15 +13,15 @@ import rx.Observable; class LocationImpl extends WrapperImpl implements Location { - private final Manager manager; + private final ResourcesManager manager; - LocationImpl(LocationInner inner, Manager manager) { + LocationImpl(LocationInner inner, ResourcesManager manager) { super(inner); this.manager = manager; } @Override - public Manager manager() { + public ResourcesManager manager() { return this.manager; } diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..b0fb2fec8d2cd --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * 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.resources.v2016_06_01.implementation; + +import com.microsoft.azure.management.resources.v2016_06_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2016_06_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ResourcesManager manager; + OperationImpl(OperationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationInner.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..08a6947d99e9e --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationInner.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.resources.v2016_06_01.implementation; + +import com.microsoft.azure.management.resources.v2016_06_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Resources operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..c7a1e8589d41c --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/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.resources.v2016_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2016_06_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2016_06_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ResourcesManager manager; + + OperationsImpl(ResourcesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsInner.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..fcee524bcb21d --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.resources.v2016_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.http.Url; +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 SubscriptionClientImpl 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, SubscriptionClientImpl 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.resources.v2016_06_01.Operations list" }) + @GET("providers/Microsoft.Resources/operations") + Observable> list(@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.resources.v2016_06_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl.java index f7c2708ca2c0e..a3cf958c7fb13 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl.java @@ -22,7 +22,7 @@ public class PageImpl implements Page { /** * The link to the next page. */ - @JsonProperty("") + @JsonProperty("nextLink") private String nextPageLink; /** diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl1.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl1.java index 5b3a6612486f1..b4dccf8d3ced8 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl1.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/PageImpl1.java @@ -22,7 +22,7 @@ public class PageImpl1 implements Page { /** * The link to the next page. */ - @JsonProperty("nextLink") + @JsonProperty("") private String nextPageLink; /** diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/ResourcesManager.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/ResourcesManager.java new file mode 100644 index 0000000000000..271c128902d23 --- /dev/null +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/ResourcesManager.java @@ -0,0 +1,120 @@ +/** + * 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.resources.v2016_06_01.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.resources.v2016_06_01.Operations; +import com.microsoft.azure.management.resources.v2016_06_01.Subscriptions; +import com.microsoft.azure.management.resources.v2016_06_01.Tenants; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Resources resource management. + */ +public final class ResourcesManager extends ManagerCore { + private Operations operations; + private Subscriptions subscriptions; + private Tenants tenants; + /** + * Get a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ResourcesManager.ConfigurableImpl(); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param credentials the credentials to use + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(AzureTokenCredentials credentials) { + return new ResourcesManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(RestClient restClient) { + return new ResourcesManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ResourcesManager that exposes Resources management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Resources management API entry points that work across subscriptions + */ + ResourcesManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @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 Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * @return Entry point to manage Tenants. + */ + public Tenants tenants() { + if (this.tenants == null) { + this.tenants = new TenantsImpl(this); + } + return this.tenants; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ResourcesManager authenticate(AzureTokenCredentials credentials) { + return ResourcesManager.authenticate(buildRestClient(credentials)); + } + } + private ResourcesManager(RestClient restClient) { + super( + restClient, + null, + new SubscriptionClientImpl(restClient)); + } +} diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionClientImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionClientImpl.java index e306938366f25..f8cf1a1ae08b7 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionClientImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionClientImpl.java @@ -40,11 +40,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -53,7 +53,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -63,11 +63,11 @@ public SubscriptionClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -76,7 +76,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -86,11 +86,11 @@ public SubscriptionClientImpl withLongRunningOperationRetryTimeout(int longRunni return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -99,7 +99,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -109,6 +109,19 @@ public SubscriptionClientImpl withGenerateClientRequestId(boolean generateClient return this; } + /** + * 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 SubscriptionsInner object to access its operations. */ @@ -170,6 +183,7 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); this.tenants = new TenantsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); @@ -182,6 +196,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "SubscriptionClient", "2016-06-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "SubscriptionClient", "2016-06-01"); } } diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionImpl.java index b463156e6001a..9853ea3bba1c9 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionImpl.java @@ -14,14 +14,14 @@ import com.microsoft.azure.management.resources.v2016_06_01.SubscriptionPolicies; class SubscriptionImpl extends WrapperImpl implements Subscription { - private final Manager manager; - SubscriptionImpl(SubscriptionInner inner, Manager manager) { + private final ResourcesManager manager; + SubscriptionImpl(SubscriptionInner inner, ResourcesManager manager) { super(inner); this.manager = manager; } @Override - public Manager manager() { + public ResourcesManager manager() { return this.manager; } diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsImpl.java index d6b6d88817c16..66683dfc4cfa6 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsImpl.java @@ -9,27 +9,24 @@ package com.microsoft.azure.management.resources.v2016_06_01.implementation; -import com.microsoft.azure.Page; -import com.microsoft.azure.PagedList; import com.microsoft.azure.arm.model.implementation.WrapperImpl; -import com.microsoft.azure.arm.utils.PagedListConverter; -import com.microsoft.azure.management.resources.v2016_06_01.Location; -import com.microsoft.azure.management.resources.v2016_06_01.Subscription; import com.microsoft.azure.management.resources.v2016_06_01.Subscriptions; -import rx.Observable; import rx.functions.Func1; - +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2016_06_01.Subscription; import java.util.List; +import com.microsoft.azure.management.resources.v2016_06_01.Location; class SubscriptionsImpl extends WrapperImpl implements Subscriptions { - private final Manager manager; + private final ResourcesManager manager; - SubscriptionsImpl(Manager manager) { + SubscriptionsImpl(ResourcesManager manager) { super(manager.inner().subscriptions()); this.manager = manager; } - public Manager manager() { + public ResourcesManager manager() { return this.manager; } @@ -45,17 +42,6 @@ public Subscription call(SubscriptionInner inner) { }); } - @Override - public PagedList list() { - return new PagedListConverter() { - - @Override - public Observable typeConvertAsync(SubscriptionInner subscriptionInner) { - return Observable.just((Subscription) new SubscriptionImpl(subscriptionInner, manager())); - } - }.convert(inner().list()); - } - @Override public Observable listAsync() { SubscriptionsInner client = this.inner(); diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsInner.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsInner.java index f06fa1cb52ce7..6c970f5c36546 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsInner.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/SubscriptionsInner.java @@ -139,7 +139,7 @@ public Observable>> listLocationsWithService @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listLocationsDelegate(response); + ServiceResponse> result = listLocationsDelegate(response); List items = null; if (result.body() != null) { items = result.body().items(); @@ -153,9 +153,9 @@ public Observable>> call(Response> listLocationsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listLocationsDelegate(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); } @@ -324,7 +324,7 @@ public Observable>> listSinglePageAsync( @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -333,9 +333,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + 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); } @@ -421,7 +421,7 @@ public Observable>> call(ServiceResponse /** * Gets all subscriptions for a tenant. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -435,7 +435,7 @@ public Observable>> listNextSinglePageAs @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -444,9 +444,9 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantIdDescriptionImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantIdDescriptionImpl.java index defc1823ffb30..1935c312615f7 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantIdDescriptionImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantIdDescriptionImpl.java @@ -12,14 +12,14 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; class TenantIdDescriptionImpl extends WrapperImpl implements TenantIdDescription { - private final Manager manager; - TenantIdDescriptionImpl(TenantIdDescriptionInner inner, Manager manager) { + private final ResourcesManager manager; + TenantIdDescriptionImpl(TenantIdDescriptionInner inner, ResourcesManager manager) { super(inner); this.manager = manager; } @Override - public Manager manager() { + public ResourcesManager manager() { return this.manager; } diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsImpl.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsImpl.java index 977976c2a56c5..72bb3b1074c61 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsImpl.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsImpl.java @@ -17,14 +17,14 @@ import com.microsoft.azure.management.resources.v2016_06_01.TenantIdDescription; class TenantsImpl extends WrapperImpl implements Tenants { - private final Manager manager; + private final ResourcesManager manager; - TenantsImpl(Manager manager) { + TenantsImpl(ResourcesManager manager) { super(manager.inner().tenants()); this.manager = manager; } - public Manager manager() { + public ResourcesManager manager() { return this.manager; } diff --git a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsInner.java b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsInner.java index 3b48bfec9d347..9309d0e622d2f 100644 --- a/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsInner.java +++ b/resources/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/resources/v2016_06_01/implementation/TenantsInner.java @@ -153,7 +153,7 @@ public Observable>> listSinglePag @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -162,9 +162,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + 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); } @@ -250,7 +250,7 @@ public Observable>> call(ServiceR /** * Gets the tenants for your account. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -264,7 +264,7 @@ public Observable>> listNextSingl @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -273,9 +273,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2016_09_01/pom.xml b/resources/resource-manager/v2016_09_01/pom.xml index f32c92d464636..3e4b50a41b64c 100644 --- a/resources/resource-manager/v2016_09_01/pom.xml +++ b/resources/resource-manager/v2016_09_01/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-resources @@ -19,7 +19,7 @@ jar Microsoft Azure SDK for Resources Management This package contains Microsoft Resources Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentExtended.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentExtended.java index 59d732305195c..988bea07ff9e5 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentExtended.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentExtended.java @@ -59,6 +59,8 @@ interface Blank extends WithResourceGroupName { interface WithResourceGroupName { /** * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist + * @return the next definition stage */ WithProperties withResourceGroupName(String resourceGroupName); } @@ -69,6 +71,8 @@ interface WithResourceGroupName { interface WithProperties { /** * Specifies properties. + * @param properties The deployment properties + * @return the next definition stage */ WithCreate withProperties(DeploymentProperties properties); } @@ -97,6 +101,8 @@ interface UpdateStages { interface WithProperties { /** * Specifies properties. + * @param properties The deployment properties + * @return the next update stage */ Update withProperties(DeploymentProperties properties); } diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentPropertiesExtended.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentPropertiesExtended.java index f4b9edba5924e..e13ee6e467a93 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentPropertiesExtended.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/DeploymentPropertiesExtended.java @@ -36,7 +36,7 @@ public class DeploymentPropertiesExtended { private DateTime timestamp; /** - * Key/value pairs that represent deploymentoutput. + * Key/value pairs that represent deployment output. */ @JsonProperty(value = "outputs") private Object outputs; @@ -120,7 +120,7 @@ public DateTime timestamp() { } /** - * Get key/value pairs that represent deploymentoutput. + * Get key/value pairs that represent deployment output. * * @return the outputs value */ @@ -129,7 +129,7 @@ public Object outputs() { } /** - * Set key/value pairs that represent deploymentoutput. + * Set key/value pairs that represent deployment output. * * @param outputs the outputs value to set * @return the DeploymentPropertiesExtended object itself. diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Deployments.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Deployments.java index 1ddc1b70768e7..4a2f2c1ec178b 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Deployments.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Deployments.java @@ -30,7 +30,7 @@ public interface Deployments extends SupportsCreating checkExistenceAsync(String resourceGroupName, String deploymentName); /** * Cancels a currently running template deployment. diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ParametersLink.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ParametersLink.java index 087bfde92ef66..b8c9489f98564 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ParametersLink.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ParametersLink.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Entity representing the reference to the deployment paramaters. + * Entity representing the reference to the deployment parameters. */ public class ParametersLink { /** diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroup.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroup.java index 8e9df83c6dde9..2878d52f14bc3 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroup.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroup.java @@ -75,6 +75,7 @@ interface Blank extends WithSubscription { interface WithSubscription { /** * Specifies . + * @return the next definition stage */ WithLocation withExistingSubscription(); } @@ -85,6 +86,8 @@ interface WithSubscription { interface WithLocation { /** * Specifies location. + * @param location The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations + * @return the next definition stage */ WithCreate withLocation(String location); } @@ -95,6 +98,8 @@ interface WithLocation { interface WithManagedBy { /** * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next definition stage */ WithCreate withManagedBy(String managedBy); } @@ -105,6 +110,8 @@ interface WithManagedBy { interface WithName { /** * Specifies name. + * @param name The name of the resource group + * @return the next definition stage */ WithCreate withName(String name); } @@ -115,6 +122,8 @@ interface WithName { interface WithProperties { /** * Specifies properties. + * @param properties the properties parameter value + * @return the next definition stage */ WithCreate withProperties(ResourceGroupProperties properties); } @@ -125,6 +134,8 @@ interface WithProperties { interface WithTags { /** * Specifies tags. + * @param tags The tags attached to the resource group + * @return the next definition stage */ WithCreate withTags(Map tags); } @@ -153,6 +164,8 @@ interface UpdateStages { interface WithManagedBy { /** * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next update stage */ Update withManagedBy(String managedBy); } @@ -163,6 +176,8 @@ interface WithManagedBy { interface WithName { /** * Specifies name. + * @param name The name of the resource group + * @return the next update stage */ Update withName(String name); } @@ -173,6 +188,8 @@ interface WithName { interface WithProperties { /** * Specifies properties. + * @param properties the properties parameter value + * @return the next update stage */ Update withProperties(ResourceGroupProperties properties); } @@ -183,6 +200,8 @@ interface WithProperties { interface WithTags { /** * Specifies tags. + * @param tags The tags attached to the resource group + * @return the next update stage */ Update withTags(Map tags); } diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroups.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroups.java index 02b11e1e48f91..7ba943d0a5c46 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroups.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/ResourceGroups.java @@ -26,7 +26,7 @@ public interface ResourceGroups extends SupportsCreating checkExistenceAsync(String resourceGroupName); /** * Captures the specified resource group as a template. diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Resources.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Resources.java index 56f92ae104552..c3d71614485dd 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Resources.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/Resources.java @@ -26,7 +26,7 @@ public interface Resources extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Completable checkExistenceByIdAsync(String resourceId, String apiVersion); + Observable checkExistenceByIdAsync(String resourceId, String apiVersion); /** * Deletes a resource by ID. @@ -82,7 +82,7 @@ public interface Resources extends HasInner { * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -101,7 +101,7 @@ public interface Resources extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Completable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); /** * Deletes a resource. diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentExtendedImpl.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentExtendedImpl.java index adefb6ea00778..2994ed627d615 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentExtendedImpl.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentExtendedImpl.java @@ -38,10 +38,10 @@ class DeploymentExtendedImpl extends CreatableUpdatableImpl checkExistenceAsync(String resourceGroupName, String deploymentName) { DeploymentsInner client = this.inner(); - return client.checkExistenceAsync(resourceGroupName, deploymentName).toCompletable(); - } + return client.checkExistenceAsync(resourceGroupName, deploymentName) + ;} @Override public Completable cancelAsync(String resourceGroupName, String deploymentName) { diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ProviderImpl.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ProviderImpl.java index bd9a46a0f9cf9..50c234a397b2b 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ProviderImpl.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ProviderImpl.java @@ -21,6 +21,7 @@ class ProviderImpl extends IndexableRefreshableWrapperImpl checkExistenceAsync(String resourceGroupName) { ResourceGroupsInner client = this.inner(); - return client.checkExistenceAsync(resourceGroupName).toCompletable(); - } + return client.checkExistenceAsync(resourceGroupName) + ;} @Override public Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceManagementClientImpl.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceManagementClientImpl.java index 72efac553a2f5..3ed7ae2ce4b58 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceManagementClientImpl.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceManagementClientImpl.java @@ -63,11 +63,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +76,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +86,11 @@ public ResourceManagementClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +99,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +109,11 @@ public ResourceManagementClientImpl withLongRunningOperationRetryTimeout(int lon return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +122,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -261,6 +261,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "ResourceManagementClient", "2016-09-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ResourceManagementClient", "2016-09-01"); } } diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesImpl.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesImpl.java index 2e73f3400cb12..bd29af61cf78a 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesImpl.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesImpl.java @@ -36,10 +36,10 @@ private SubscriptionGenericResourceImpl wrapModel(GenericResourceInner inner) { } @Override - public Completable checkExistenceByIdAsync(String resourceId, String apiVersion) { + public Observable checkExistenceByIdAsync(String resourceId, String apiVersion) { ResourcesInner client = this.inner(); - return client.checkExistenceByIdAsync(resourceId, apiVersion).toCompletable(); - } + return client.checkExistenceByIdAsync(resourceId, apiVersion) + ;} @Override public Completable deleteByIdAsync(String resourceId, String apiVersion) { @@ -108,10 +108,10 @@ public Completable moveResourcesAsync(String sourceResourceGroupName, ResourcesM } @Override - public Completable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + public Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { ResourcesInner client = this.inner(); - return client.checkExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toCompletable(); - } + return client.checkExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion) + ;} @Override public Completable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { diff --git a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesInner.java b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesInner.java index 5da6ae27ece2a..730c0cc67d524 100644 --- a/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesInner.java +++ b/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourcesInner.java @@ -151,7 +151,7 @@ interface ResourcesService { * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -165,7 +165,7 @@ public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo para * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -179,7 +179,7 @@ public ServiceFuture moveResourcesAsync(String sourceResourceGroupName, Re * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -197,7 +197,7 @@ public Void call(ServiceResponse response) { * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -224,7 +224,7 @@ public Observable> moveResourcesWithServiceResponseAsync(S * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -238,7 +238,7 @@ public void beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -252,7 +252,7 @@ public ServiceFuture beginMoveResourcesAsync(String sourceResourceGroupNam * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -270,7 +270,7 @@ public Void call(ServiceResponse response) { * Moves resources from one resource group to another resource group. * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. * - * @param sourceResourceGroupName The name of the resource group containing the rsources to move. + * @param sourceResourceGroupName The name of the resource group containing the resources to move. * @param parameters Parameters for moving resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. diff --git a/resources/resource-manager/v2018_02_01/pom.xml b/resources/resource-manager/v2018_02_01/pom.xml index c8482a14c284d..3f080ea1daf71 100644 --- a/resources/resource-manager/v2018_02_01/pom.xml +++ b/resources/resource-manager/v2018_02_01/pom.xml @@ -11,15 +11,15 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-resources - 1.0.0-beta-1 + 1.0.0-beta jar Microsoft Azure SDK for Resources Management This package contains Microsoft Resources Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentExtended.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentExtended.java index e1dec4004aec6..b15b190ad025c 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentExtended.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentExtended.java @@ -59,6 +59,8 @@ interface Blank extends WithResourceGroupName { interface WithResourceGroupName { /** * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist + * @return the next definition stage */ WithProperties withResourceGroupName(String resourceGroupName); } @@ -69,6 +71,8 @@ interface WithResourceGroupName { interface WithProperties { /** * Specifies properties. + * @param properties The deployment properties + * @return the next definition stage */ WithCreate withProperties(DeploymentProperties properties); } @@ -97,6 +101,8 @@ interface UpdateStages { interface WithProperties { /** * Specifies properties. + * @param properties The deployment properties + * @return the next update stage */ Update withProperties(DeploymentProperties properties); } diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentPropertiesExtended.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentPropertiesExtended.java index 2a3eb61e53fc9..61027f45b92a1 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentPropertiesExtended.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/DeploymentPropertiesExtended.java @@ -36,7 +36,7 @@ public class DeploymentPropertiesExtended { private DateTime timestamp; /** - * Key/value pairs that represent deploymentoutput. + * Key/value pairs that represent deployment output. */ @JsonProperty(value = "outputs") private Object outputs; @@ -126,7 +126,7 @@ public DateTime timestamp() { } /** - * Get key/value pairs that represent deploymentoutput. + * Get key/value pairs that represent deployment output. * * @return the outputs value */ @@ -135,7 +135,7 @@ public Object outputs() { } /** - * Set key/value pairs that represent deploymentoutput. + * Set key/value pairs that represent deployment output. * * @param outputs the outputs value to set * @return the DeploymentPropertiesExtended object itself. diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Deployments.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Deployments.java index ab1b9412c9c4e..81aeb5b27e16c 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Deployments.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Deployments.java @@ -30,7 +30,7 @@ public interface Deployments extends SupportsCreating checkExistenceAsync(String resourceGroupName, String deploymentName); /** * Cancels a currently running template deployment. diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ParametersLink.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ParametersLink.java index 6e7632d8f5551..ba8711528d532 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ParametersLink.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ParametersLink.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Entity representing the reference to the deployment paramaters. + * Entity representing the reference to the deployment parameters. */ public class ParametersLink { /** diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroup.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroup.java index 3652cf418a5b5..5b57231a7e3c1 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroup.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroup.java @@ -75,6 +75,7 @@ interface Blank extends WithSubscription { interface WithSubscription { /** * Specifies . + * @return the next definition stage */ WithLocation withExistingSubscription(); } @@ -85,6 +86,8 @@ interface WithSubscription { interface WithLocation { /** * Specifies location. + * @param location The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations + * @return the next definition stage */ WithCreate withLocation(String location); } @@ -95,6 +98,8 @@ interface WithLocation { interface WithManagedBy { /** * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next definition stage */ WithCreate withManagedBy(String managedBy); } @@ -105,6 +110,8 @@ interface WithManagedBy { interface WithName { /** * Specifies name. + * @param name The name of the resource group + * @return the next definition stage */ WithCreate withName(String name); } @@ -115,6 +122,8 @@ interface WithName { interface WithProperties { /** * Specifies properties. + * @param properties the properties parameter value + * @return the next definition stage */ WithCreate withProperties(ResourceGroupProperties properties); } @@ -125,6 +134,8 @@ interface WithProperties { interface WithTags { /** * Specifies tags. + * @param tags The tags attached to the resource group + * @return the next definition stage */ WithCreate withTags(Map tags); } @@ -153,6 +164,8 @@ interface UpdateStages { interface WithManagedBy { /** * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next update stage */ Update withManagedBy(String managedBy); } @@ -163,6 +176,8 @@ interface WithManagedBy { interface WithName { /** * Specifies name. + * @param name The name of the resource group + * @return the next update stage */ Update withName(String name); } @@ -173,6 +188,8 @@ interface WithName { interface WithProperties { /** * Specifies properties. + * @param properties the properties parameter value + * @return the next update stage */ Update withProperties(ResourceGroupProperties properties); } @@ -183,6 +200,8 @@ interface WithProperties { interface WithTags { /** * Specifies tags. + * @param tags The tags attached to the resource group + * @return the next update stage */ Update withTags(Map tags); } diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroups.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroups.java index aa21480a91cae..9393810d6c628 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroups.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/ResourceGroups.java @@ -25,7 +25,7 @@ public interface ResourceGroups extends SupportsCreating checkExistenceAsync(String resourceGroupName); /** * Captures the specified resource group as a template. diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Resources.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Resources.java index ea0f13adfa3de..31815daed7108 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Resources.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/Resources.java @@ -34,7 +34,7 @@ public interface Resources extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Completable checkExistenceByIdAsync(String resourceId, String apiVersion); + Observable checkExistenceByIdAsync(String resourceId, String apiVersion); /** * Deletes a resource by ID. @@ -121,7 +121,7 @@ public interface Resources extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Completable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); /** * Deletes a resource. diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentExtendedImpl.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentExtendedImpl.java index 62c9568f500bd..5a1230b0f757b 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentExtendedImpl.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentExtendedImpl.java @@ -38,10 +38,10 @@ class DeploymentExtendedImpl extends CreatableUpdatableImpl checkExistenceAsync(String resourceGroupName, String deploymentName) { DeploymentsInner client = this.inner(); - return client.checkExistenceAsync(resourceGroupName, deploymentName).toCompletable(); - } + return client.checkExistenceAsync(resourceGroupName, deploymentName) + ;} @Override public Completable cancelAsync(String resourceGroupName, String deploymentName) { diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ProviderImpl.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ProviderImpl.java index e4a5ffdec2faf..331a1cbbb450f 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ProviderImpl.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ProviderImpl.java @@ -21,6 +21,7 @@ class ProviderImpl extends IndexableRefreshableWrapperImpl checkExistenceAsync(String resourceGroupName) { ResourceGroupsInner client = this.inner(); - return client.checkExistenceAsync(resourceGroupName).toCompletable(); - } + return client.checkExistenceAsync(resourceGroupName) + ;} @Override public Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourceManagementClientImpl.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourceManagementClientImpl.java index 1ca867bc55a3b..acec4803ee679 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourceManagementClientImpl.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourceManagementClientImpl.java @@ -63,11 +63,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +76,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +86,11 @@ public ResourceManagementClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +99,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +109,11 @@ public ResourceManagementClientImpl withLongRunningOperationRetryTimeout(int lon return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +122,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -261,6 +261,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "ResourceManagementClient", "2018-02-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ResourceManagementClient", "2018-02-01"); } } diff --git a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesImpl.java b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesImpl.java index 7d31838c0946d..5ddd1482d32db 100644 --- a/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesImpl.java +++ b/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesImpl.java @@ -53,10 +53,10 @@ public GenericResource call(GenericResourceInner inner) { } @Override - public Completable checkExistenceByIdAsync(String resourceId, String apiVersion) { + public Observable checkExistenceByIdAsync(String resourceId, String apiVersion) { ResourcesInner client = this.inner(); - return client.checkExistenceByIdAsync(resourceId, apiVersion).toCompletable(); - } + return client.checkExistenceByIdAsync(resourceId, apiVersion) + ;} @Override public Completable deleteByIdAsync(String resourceId, String apiVersion) { @@ -131,10 +131,10 @@ public Completable validateMoveResourcesAsync(String sourceResourceGroupName, Re } @Override - public Completable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + public Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { ResourcesInner client = this.inner(); - return client.checkExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toCompletable(); - } + return client.checkExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion) + ;} @Override public Completable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { diff --git a/resources/resource-manager/v2018_06_01/pom.xml b/resources/resource-manager/v2018_06_01/pom.xml new file mode 100644 index 0000000000000..ea78292e95b56 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.resources.v2018_06_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-resources + 1.0.0-beta + jar + Microsoft Azure SDK for Resources Management + This package contains Microsoft Resources 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 + + + + + + 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/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.java new file mode 100644 index 0000000000000..21ff9f051cfdc --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Location.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.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.LocationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; + +/** + * Type representing Location. + */ +public interface Location extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the latitude value. + */ + String latitude(); + + /** + * @return the longitude value. + */ + String longitude(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java new file mode 100644 index 0000000000000..82b99b86f4e33 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operation.java @@ -0,0 +1,30 @@ +/** + * 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.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.java new file mode 100644 index 0000000000000..4e8cd7776b811 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/OperationDisplay.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.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Resources. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.Resources. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Resources. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay 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 OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java new file mode 100644 index 0000000000000..105dd1e27b099 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.resources.v2018_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java new file mode 100644 index 0000000000000..56c5366ae0cf3 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SpendingLimit.java @@ -0,0 +1,56 @@ +/** + * 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.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SpendingLimit. + */ +public enum SpendingLimit { + /** Enum value On. */ + ON("On"), + + /** Enum value Off. */ + OFF("Off"), + + /** Enum value CurrentPeriodOff. */ + CURRENT_PERIOD_OFF("CurrentPeriodOff"); + + /** The actual serialized value for a SpendingLimit instance. */ + private String value; + + SpendingLimit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SpendingLimit instance. + * + * @param value the serialized value to parse. + * @return the parsed SpendingLimit object, or null if unable to parse. + */ + @JsonCreator + public static SpendingLimit fromString(String value) { + SpendingLimit[] items = SpendingLimit.values(); + for (SpendingLimit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java new file mode 100644 index 0000000000000..d1092af976d67 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscription.java @@ -0,0 +1,55 @@ +/** + * 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.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.SubscriptionInner; + +/** + * Type representing Subscription. + */ +public interface Subscription extends HasInner, HasManager { + /** + * @return the authorizationSource value. + */ + String authorizationSource(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the state value. + */ + SubscriptionState state(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subscriptionPolicies value. + */ + SubscriptionPolicies subscriptionPolicies(); + + /** + * @return the tenantId value. + */ + String tenantId(); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java new file mode 100644 index 0000000000000..d63439320814a --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionPolicies.java @@ -0,0 +1,66 @@ +/** + * 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.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription policies. + */ +public class SubscriptionPolicies { + /** + * The subscription location placement ID. The ID indicates which regions + * are visible for a subscription. For example, a subscription with a + * location placement Id of Public_2014-09-01 has access to Azure public + * regions. + */ + @JsonProperty(value = "locationPlacementId", access = JsonProperty.Access.WRITE_ONLY) + private String locationPlacementId; + + /** + * The subscription quota ID. + */ + @JsonProperty(value = "quotaId", access = JsonProperty.Access.WRITE_ONLY) + private String quotaId; + + /** + * The subscription spending limit. Possible values include: 'On', 'Off', + * 'CurrentPeriodOff'. + */ + @JsonProperty(value = "spendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimit spendingLimit; + + /** + * Get the subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. + * + * @return the locationPlacementId value + */ + public String locationPlacementId() { + return this.locationPlacementId; + } + + /** + * Get the subscription quota ID. + * + * @return the quotaId value + */ + public String quotaId() { + return this.quotaId; + } + + /** + * Get the subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff'. + * + * @return the spendingLimit value + */ + public SpendingLimit spendingLimit() { + return this.spendingLimit; + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java new file mode 100644 index 0000000000000..b95c3f15619f4 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/SubscriptionState.java @@ -0,0 +1,62 @@ +/** + * 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.resources.v2018_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SubscriptionState. + */ +public enum SubscriptionState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Warned. */ + WARNED("Warned"), + + /** Enum value PastDue. */ + PAST_DUE("PastDue"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Deleted. */ + DELETED("Deleted"); + + /** The actual serialized value for a SubscriptionState instance. */ + private String value; + + SubscriptionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SubscriptionState instance. + * + * @param value the serialized value to parse. + * @return the parsed SubscriptionState object, or null if unable to parse. + */ + @JsonCreator + public static SubscriptionState fromString(String value) { + SubscriptionState[] items = SubscriptionState.values(); + for (SubscriptionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.java new file mode 100644 index 0000000000000..6235c858aad63 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Subscriptions.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.resources.v2018_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2018_06_01.Location; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions extends HasInner { + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String subscriptionId); + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLocationsAsync(String subscriptionId); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.java new file mode 100644 index 0000000000000..697bff6aff682 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/TenantIdDescription.java @@ -0,0 +1,30 @@ +/** + * 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.resources.v2018_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.TenantIdDescriptionInner; + +/** + * Type representing TenantIdDescription. + */ +public interface TenantIdDescription extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the tenantId value. + */ + String tenantId(); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java new file mode 100644 index 0000000000000..393eb21bb4ea1 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/Tenants.java @@ -0,0 +1,27 @@ +/** + * 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.resources.v2018_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2018_06_01.implementation.TenantsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Tenants. + */ +public interface Tenants extends HasInner { + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/IdParsingUtils.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..9dae72f0db0c5 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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.resources.v2018_06_01.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/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.java new file mode 100644 index 0000000000000..81b0ce0ab5184 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationImpl.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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.Location; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class LocationImpl extends WrapperImpl implements Location { + private final ResourcesManager manager; + + LocationImpl(LocationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String latitude() { + return this.inner().latitude(); + } + + @Override + public String longitude() { + return this.inner().longitude(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java new file mode 100644 index 0000000000000..cd6c91f43c5ad --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/LocationInner.java @@ -0,0 +1,108 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Location information. + */ +public class LocationInner { + /** + * The fully qualified ID of the location. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The subscription ID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The display name of the location. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The latitude of the location. + */ + @JsonProperty(value = "latitude", access = JsonProperty.Access.WRITE_ONLY) + private String latitude; + + /** + * The longitude of the location. + */ + @JsonProperty(value = "longitude", access = JsonProperty.Access.WRITE_ONLY) + private String longitude; + + /** + * Get the fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display name of the location. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the latitude of the location. + * + * @return the latitude value + */ + public String latitude() { + return this.latitude; + } + + /** + * Get the longitude of the location. + * + * @return the longitude value + */ + public String longitude() { + return this.longitude; + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..3d03d139d2b7f --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ResourcesManager manager; + OperationImpl(OperationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..a4199715eb3a0 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationInner.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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Resources operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..ac7b46c4d97d2 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2018_06_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ResourcesManager manager; + + OperationsImpl(ResourcesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..e87b4f4108b28 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.http.Url; +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 SubscriptionClientImpl 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, SubscriptionClientImpl 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.resources.v2018_06_01.Operations list" }) + @GET("providers/Microsoft.Resources/operations") + Observable> list(@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.resources.v2018_06_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..77d66fbd2a0e8 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("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/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.java new file mode 100644 index 0000000000000..f7d8237cffae2 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/PageImpl1.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.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + 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 PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java new file mode 100644 index 0000000000000..cc1e7794a22f1 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/ResourcesManager.java @@ -0,0 +1,120 @@ +/** + * 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.resources.v2018_06_01.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.resources.v2018_06_01.Operations; +import com.microsoft.azure.management.resources.v2018_06_01.Subscriptions; +import com.microsoft.azure.management.resources.v2018_06_01.Tenants; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Resources resource management. + */ +public final class ResourcesManager extends ManagerCore { + private Operations operations; + private Subscriptions subscriptions; + private Tenants tenants; + /** + * Get a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ResourcesManager.ConfigurableImpl(); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param credentials the credentials to use + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(AzureTokenCredentials credentials) { + return new ResourcesManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(RestClient restClient) { + return new ResourcesManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ResourcesManager that exposes Resources management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Resources management API entry points that work across subscriptions + */ + ResourcesManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @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 Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * @return Entry point to manage Tenants. + */ + public Tenants tenants() { + if (this.tenants == null) { + this.tenants = new TenantsImpl(this); + } + return this.tenants; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ResourcesManager authenticate(AzureTokenCredentials credentials) { + return ResourcesManager.authenticate(buildRestClient(credentials)); + } + } + private ResourcesManager(RestClient restClient) { + super( + restClient, + null, + new SubscriptionClientImpl(restClient)); + } +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java new file mode 100644 index 0000000000000..7a4bac4c6a18d --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionClientImpl.java @@ -0,0 +1,201 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.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 SubscriptionClientImpl class. + */ +public class SubscriptionClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @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 SubscriptionClientImpl 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 SubscriptionClientImpl 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 SubscriptionClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * 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 SubscriptionsInner object to access its operations. + */ + private SubscriptionsInner subscriptions; + + /** + * Gets the SubscriptionsInner object to access its operations. + * @return the SubscriptionsInner object. + */ + public SubscriptionsInner subscriptions() { + return this.subscriptions; + } + + /** + * The TenantsInner object to access its operations. + */ + private TenantsInner tenants; + + /** + * Gets the TenantsInner object to access its operations. + * @return the TenantsInner object. + */ + public TenantsInner tenants() { + return this.tenants; + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param credentials the management credentials for Azure + */ + public SubscriptionClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SubscriptionClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SubscriptionClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2016-06-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.tenants = new TenantsInner(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(), "SubscriptionClient", "2016-06-01"); + } +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java new file mode 100644 index 0000000000000..84f779849eca9 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionImpl.java @@ -0,0 +1,63 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.Subscription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionState; +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionPolicies; + +class SubscriptionImpl extends WrapperImpl implements Subscription { + private final ResourcesManager manager; + SubscriptionImpl(SubscriptionInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String authorizationSource() { + return this.inner().authorizationSource(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public SubscriptionState state() { + return this.inner().state(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public SubscriptionPolicies subscriptionPolicies() { + return this.inner().subscriptionPolicies(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java new file mode 100644 index 0000000000000..c19037428d67c --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionInner.java @@ -0,0 +1,151 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionState; +import com.microsoft.azure.management.resources.v2018_06_01.SubscriptionPolicies; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription information. + */ +public class SubscriptionInner { + /** + * The fully qualified ID for the subscription. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The subscription ID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The subscription display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The subscription tenant ID. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The subscription state. Possible values are Enabled, Warned, PastDue, + * Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', + * 'PastDue', 'Disabled', 'Deleted'. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private SubscriptionState state; + + /** + * The subscription policies. + */ + @JsonProperty(value = "subscriptionPolicies") + private SubscriptionPolicies subscriptionPolicies; + + /** + * The authorization source of the request. Valid values are one or more + * combinations of Legacy, RoleBased, Bypassed, Direct and Management. For + * example, 'Legacy, RoleBased'. + */ + @JsonProperty(value = "authorizationSource") + private String authorizationSource; + + /** + * Get the fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscription display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the subscription tenant ID. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted'. + * + * @return the state value + */ + public SubscriptionState state() { + return this.state; + } + + /** + * Get the subscription policies. + * + * @return the subscriptionPolicies value + */ + public SubscriptionPolicies subscriptionPolicies() { + return this.subscriptionPolicies; + } + + /** + * Set the subscription policies. + * + * @param subscriptionPolicies the subscriptionPolicies value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withSubscriptionPolicies(SubscriptionPolicies subscriptionPolicies) { + this.subscriptionPolicies = subscriptionPolicies; + return this; + } + + /** + * Get the authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * + * @return the authorizationSource value + */ + public String authorizationSource() { + return this.authorizationSource; + } + + /** + * Set the authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * + * @param authorizationSource the authorizationSource value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withAuthorizationSource(String authorizationSource) { + this.authorizationSource = authorizationSource; + return this; + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java new file mode 100644 index 0000000000000..f6db9b50dca74 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.Subscriptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2018_06_01.Subscription; +import java.util.List; +import com.microsoft.azure.management.resources.v2018_06_01.Location; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final ResourcesManager manager; + + SubscriptionsImpl(ResourcesManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.getAsync(subscriptionId) + .map(new Func1() { + @Override + public Subscription call(SubscriptionInner inner) { + return new SubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + SubscriptionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Subscription call(SubscriptionInner inner) { + return new SubscriptionImpl(inner, manager()); + } + }); + } + + private LocationImpl wrapLocationModel(LocationInner inner) { + return new LocationImpl(inner, manager()); + } + + @Override + public Observable listLocationsAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.listLocationsAsync(subscriptionId) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Location call(LocationInner inner) { + return wrapLocationModel(inner); + } + }); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java new file mode 100644 index 0000000000000..fc97957b2c483 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/SubscriptionsInner.java @@ -0,0 +1,454 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Subscriptions. + */ +public class SubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of SubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(SubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Subscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions listLocations" }) + @GET("subscriptions/{subscriptionId}/locations") + Observable> listLocations(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions get" }) + @GET("subscriptions/{subscriptionId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Subscriptions list" }) + @GET("subscriptions") + Observable> list(@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.resources.v2018_06_01.Subscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @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<LocationInner> object if successful. + */ + public List listLocations(String subscriptionId) { + return listLocationsWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @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> listLocationsAsync(String subscriptionId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listLocationsWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocationInner> object + */ + public Observable> listLocationsAsync(String subscriptionId) { + return listLocationsWithServiceResponseAsync(subscriptionId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocationInner> object + */ + public Observable>> listLocationsWithServiceResponseAsync(String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter 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.listLocations(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLocationsDelegate(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> listLocationsDelegate(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); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @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 SubscriptionInner object if successful. + */ + public SubscriptionInner get(String subscriptionId) { + return getWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @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 subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionInner object + */ + public Observable getAsync(String subscriptionId) { + return getWithServiceResponseAsync(subscriptionId).map(new Func1, SubscriptionInner>() { + @Override + public SubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter 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.get(subscriptionId, 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); + } + + /** + * Gets all subscriptions for a tenant. + * + * @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 PagedList<SubscriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all subscriptions for a tenant. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<SubscriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java new file mode 100644 index 0000000000000..09cf8873fc6e2 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionImpl.java @@ -0,0 +1,36 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.management.resources.v2018_06_01.TenantIdDescription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class TenantIdDescriptionImpl extends WrapperImpl implements TenantIdDescription { + private final ResourcesManager manager; + TenantIdDescriptionImpl(TenantIdDescriptionInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java new file mode 100644 index 0000000000000..2d4e66526de01 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantIdDescriptionInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2018_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tenant Id information. + */ +public class TenantIdDescriptionInner { + /** + * The fully qualified ID of the tenant. For example, + * /tenants/00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tenant ID. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.java new file mode 100644 index 0000000000000..9c7e1ff89db87 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsImpl.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.resources.v2018_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2018_06_01.Tenants; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2018_06_01.TenantIdDescription; + +class TenantsImpl extends WrapperImpl implements Tenants { + private final ResourcesManager manager; + + TenantsImpl(ResourcesManager manager) { + super(manager.inner().tenants()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + TenantsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TenantIdDescription call(TenantIdDescriptionInner inner) { + return new TenantIdDescriptionImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java new file mode 100644 index 0000000000000..3d66cf9bb7404 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/TenantsInner.java @@ -0,0 +1,283 @@ +/** + * 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.resources.v2018_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tenants. + */ +public class TenantsInner { + /** The Retrofit service to perform REST calls. */ + private TenantsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of TenantsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(TenantsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tenants to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2018_06_01.Tenants list" }) + @GET("tenants") + Observable> list(@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.resources.v2018_06_01.Tenants listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the tenants for your account. + * + * @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 PagedList<TenantIdDescriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the tenants for your account. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<TenantIdDescriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the tenants for your account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/package-info.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/implementation/package-info.java new file mode 100644 index 0000000000000..345300aba97fc --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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 SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. + */ +package com.microsoft.azure.management.resources.v2018_06_01.implementation; diff --git a/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/package-info.java b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/package-info.java new file mode 100644 index 0000000000000..7a28dc3f0e5e6 --- /dev/null +++ b/resources/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/resources/v2018_06_01/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 SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. + */ +package com.microsoft.azure.management.resources.v2018_06_01; diff --git a/resources/resource-manager/v2019_03_01/pom.xml b/resources/resource-manager/v2019_03_01/pom.xml new file mode 100644 index 0000000000000..166d714db1673 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.resources.v2019_03_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-resources + 1.0.0-beta + jar + Microsoft Azure SDK for Resources Management + This package contains Microsoft Resources 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 + + + + + + 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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasPathType.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasPathType.java new file mode 100644 index 0000000000000..bc10cfda5c04b --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasPathType.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.resources.v2019_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The type of the paths for alias. + */ +public class AliasPathType { + /** + * The path of an alias. + */ + @JsonProperty(value = "path") + private String path; + + /** + * The API versions. + */ + @JsonProperty(value = "apiVersions") + private List apiVersions; + + /** + * Get the path of an alias. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path of an alias. + * + * @param path the path value to set + * @return the AliasPathType object itself. + */ + public AliasPathType withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the API versions. + * + * @return the apiVersions value + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Set the API versions. + * + * @param apiVersions the apiVersions value to set + * @return the AliasPathType object itself. + */ + public AliasPathType withApiVersions(List apiVersions) { + this.apiVersions = apiVersions; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasType.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasType.java new file mode 100644 index 0000000000000..66f0e7945807f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/AliasType.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.resources.v2019_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The alias type. + */ +public class AliasType { + /** + * The alias name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The paths for an alias. + */ + @JsonProperty(value = "paths") + private List paths; + + /** + * Get the alias name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the alias name. + * + * @param name the name value to set + * @return the AliasType object itself. + */ + public AliasType withName(String name) { + this.name = name; + return this; + } + + /** + * Get the paths for an alias. + * + * @return the paths value + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths for an alias. + * + * @param paths the paths value to set + * @return the AliasType object itself. + */ + public AliasType withPaths(List paths) { + this.paths = paths; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/BasicDependency.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/BasicDependency.java new file mode 100644 index 0000000000000..e25f08aa0269b --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/BasicDependency.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment dependency information. + */ +public class BasicDependency { + /** + * The ID of the dependency. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The dependency resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The dependency resource name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * Get the ID of the dependency. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the dependency. + * + * @param id the id value to set + * @return the BasicDependency object itself. + */ + public BasicDependency withId(String id) { + this.id = id; + return this; + } + + /** + * Get the dependency resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the dependency resource type. + * + * @param resourceType the resourceType value to set + * @return the BasicDependency object itself. + */ + public BasicDependency withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the dependency resource name. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the dependency resource name. + * + * @param resourceName the resourceName value to set + * @return the BasicDependency object itself. + */ + public BasicDependency withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DebugSetting.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DebugSetting.java new file mode 100644 index 0000000000000..26b0d6c1fb1ca --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DebugSetting.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. + */ + +package com.microsoft.azure.management.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The DebugSetting model. + */ +public class DebugSetting { + /** + * Specifies the type of information to log for debugging. The permitted + * values are none, requestContent, responseContent, or both requestContent + * and responseContent separated by a comma. The default is none. When + * setting this value, carefully consider the type of information you are + * passing in during deployment. By logging information about the request + * or response, you could potentially expose sensitive data that is + * retrieved through the deployment operations. + */ + @JsonProperty(value = "detailLevel") + private String detailLevel; + + /** + * Get specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + * + * @return the detailLevel value + */ + public String detailLevel() { + return this.detailLevel; + } + + /** + * Set specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + * + * @param detailLevel the detailLevel value to set + * @return the DebugSetting object itself. + */ + public DebugSetting withDetailLevel(String detailLevel) { + this.detailLevel = detailLevel; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Dependency.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Dependency.java new file mode 100644 index 0000000000000..1cea0f76a2d5f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Dependency.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.resources.v2019_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment dependency information. + */ +public class Dependency { + /** + * The list of dependencies. + */ + @JsonProperty(value = "dependsOn") + private List dependsOn; + + /** + * The ID of the dependency. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The dependency resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The dependency resource name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * Get the list of dependencies. + * + * @return the dependsOn value + */ + public List dependsOn() { + return this.dependsOn; + } + + /** + * Set the list of dependencies. + * + * @param dependsOn the dependsOn value to set + * @return the Dependency object itself. + */ + public Dependency withDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get the ID of the dependency. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the dependency. + * + * @param id the id value to set + * @return the Dependency object itself. + */ + public Dependency withId(String id) { + this.id = id; + return this; + } + + /** + * Get the dependency resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the dependency resource type. + * + * @param resourceType the resourceType value to set + * @return the Dependency object itself. + */ + public Dependency withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the dependency resource name. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the dependency resource name. + * + * @param resourceName the resourceName value to set + * @return the Dependency object itself. + */ + public Dependency withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExportResult.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExportResult.java new file mode 100644 index 0000000000000..20fa9631cf049 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExportResult.java @@ -0,0 +1,25 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentExportResultInner; + +/** + * Type representing DeploymentExportResult. + */ +public interface DeploymentExportResult extends HasInner, HasManager { + /** + * @return the template value. + */ + Object template(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtended.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtended.java new file mode 100644 index 0000000000000..f6cf6ffb0da30 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtended.java @@ -0,0 +1,133 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentExtendedInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; + +/** + * Type representing DeploymentExtended. + */ +public interface DeploymentExtended extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DeploymentExtended definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of DeploymentExtended definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DeploymentExtended definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the deploymentextended definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist + * @return the next definition stage + */ + WithProperties withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the deploymentextended definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties The deployment properties + * @return the next definition stage + */ + WithCreate withProperties(DeploymentProperties properties); + } + + /** + * The stage of the deploymentextended definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location to store the deployment data + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * 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 { + } + } + /** + * The template for a DeploymentExtended update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation { + } + + /** + * Grouping of DeploymentExtended update stages. + */ + interface UpdateStages { + /** + * The stage of the deploymentextended update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location to store the deployment data + * @return the next update stage + */ + Update withLocation(String location); + } + + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtendedFilter.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtendedFilter.java new file mode 100644 index 0000000000000..cca6f9a1001e5 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentExtendedFilter.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment filter. + */ +public class DeploymentExtendedFilter { + /** + * The provisioning state. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** + * Get the provisioning state. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state. + * + * @param provisioningState the provisioningState value to set + * @return the DeploymentExtendedFilter object itself. + */ + public DeploymentExtendedFilter withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentMode.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentMode.java new file mode 100644 index 0000000000000..4828bb3e61f34 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentMode.java @@ -0,0 +1,53 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DeploymentMode. + */ +public enum DeploymentMode { + /** Enum value Incremental. */ + INCREMENTAL("Incremental"), + + /** Enum value Complete. */ + COMPLETE("Complete"); + + /** The actual serialized value for a DeploymentMode instance. */ + private String value; + + DeploymentMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DeploymentMode instance. + * + * @param value the serialized value to parse. + * @return the parsed DeploymentMode object, or null if unable to parse. + */ + @JsonCreator + public static DeploymentMode fromString(String value) { + DeploymentMode[] items = DeploymentMode.values(); + for (DeploymentMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperation.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperation.java new file mode 100644 index 0000000000000..54e304cc59422 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperation.java @@ -0,0 +1,37 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentOperationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; + +/** + * Type representing DeploymentOperation. + */ +public interface DeploymentOperation extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the operationId value. + */ + String operationId(); + + /** + * @return the properties value. + */ + DeploymentOperationProperties properties(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperationProperties.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperationProperties.java new file mode 100644 index 0000000000000..2db6bebd5d81e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperationProperties.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.resources.v2019_03_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation properties. + */ +public class DeploymentOperationProperties { + /** + * The state of the provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The date and time of the operation. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Deployment operation service request id. + */ + @JsonProperty(value = "serviceRequestId", access = JsonProperty.Access.WRITE_ONLY) + private String serviceRequestId; + + /** + * Operation status code. + */ + @JsonProperty(value = "statusCode", access = JsonProperty.Access.WRITE_ONLY) + private String statusCode; + + /** + * Operation status message. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private Object statusMessage; + + /** + * The target resource. + */ + @JsonProperty(value = "targetResource", access = JsonProperty.Access.WRITE_ONLY) + private TargetResource targetResource; + + /** + * The HTTP request message. + */ + @JsonProperty(value = "request", access = JsonProperty.Access.WRITE_ONLY) + private HttpMessage request; + + /** + * The HTTP response message. + */ + @JsonProperty(value = "response", access = JsonProperty.Access.WRITE_ONLY) + private HttpMessage response; + + /** + * Get the state of the provisioning. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the date and time of the operation. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get deployment operation service request id. + * + * @return the serviceRequestId value + */ + public String serviceRequestId() { + return this.serviceRequestId; + } + + /** + * Get operation status code. + * + * @return the statusCode value + */ + public String statusCode() { + return this.statusCode; + } + + /** + * Get operation status message. + * + * @return the statusMessage value + */ + public Object statusMessage() { + return this.statusMessage; + } + + /** + * Get the target resource. + * + * @return the targetResource value + */ + public TargetResource targetResource() { + return this.targetResource; + } + + /** + * Get the HTTP request message. + * + * @return the request value + */ + public HttpMessage request() { + return this.request; + } + + /** + * Get the HTTP response message. + * + * @return the response value + */ + public HttpMessage response() { + return this.response; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperations.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperations.java new file mode 100644 index 0000000000000..9b3dbdec45a88 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentOperations.java @@ -0,0 +1,59 @@ +/** + * 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.resources.v2019_03_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DeploymentOperations. + */ +public interface DeploymentOperations extends HasInner { + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String deploymentName, String operationId); + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName, final String deploymentName); + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtSubscriptionScopeAsync(String deploymentName, String operationId); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtSubscriptionScopeAsync(final String deploymentName); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentProperties.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentProperties.java new file mode 100644 index 0000000000000..c9d4243c821a8 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentProperties.java @@ -0,0 +1,216 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment properties. + */ +public class DeploymentProperties { + /** + * The template content. You use this element when you want to pass the + * template syntax directly in the request rather than link to an existing + * template. It can be a JObject or well-formed JSON string. Use either the + * templateLink property or the template property, but not both. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The URI of the template. Use either the templateLink property or the + * template property, but not both. + */ + @JsonProperty(value = "templateLink") + private TemplateLink templateLink; + + /** + * Name and value pairs that define the deployment parameters for the + * template. You use this element when you want to provide the parameter + * values directly in the request rather than link to an existing parameter + * file. Use either the parametersLink property or the parameters property, + * but not both. It can be a JObject or a well formed JSON string. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * The URI of parameters file. You use this element to link to an existing + * parameters file. Use either the parametersLink property or the + * parameters property, but not both. + */ + @JsonProperty(value = "parametersLink") + private ParametersLink parametersLink; + + /** + * The mode that is used to deploy resources. This value can be either + * Incremental or Complete. In Incremental mode, resources are deployed + * without deleting existing resources that are not included in the + * template. In Complete mode, resources are deployed and existing + * resources in the resource group that are not included in the template + * are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: + * 'Incremental', 'Complete'. + */ + @JsonProperty(value = "mode", required = true) + private DeploymentMode mode; + + /** + * The debug setting of the deployment. + */ + @JsonProperty(value = "debugSetting") + private DebugSetting debugSetting; + + /** + * The deployment on error behavior. + */ + @JsonProperty(value = "onErrorDeployment") + private OnErrorDeployment onErrorDeployment; + + /** + * Get the template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + * + * @param template the template value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the URI of the template. Use either the templateLink property or the template property, but not both. + * + * @return the templateLink value + */ + public TemplateLink templateLink() { + return this.templateLink; + } + + /** + * Set the URI of the template. Use either the templateLink property or the template property, but not both. + * + * @param templateLink the templateLink value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTemplateLink(TemplateLink templateLink) { + this.templateLink = templateLink; + return this; + } + + /** + * Get name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + * + * @param parameters the parameters value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + * + * @return the parametersLink value + */ + public ParametersLink parametersLink() { + return this.parametersLink; + } + + /** + * Set the URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + * + * @param parametersLink the parametersLink value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withParametersLink(ParametersLink parametersLink) { + this.parametersLink = parametersLink; + return this; + } + + /** + * Get the mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete'. + * + * @return the mode value + */ + public DeploymentMode mode() { + return this.mode; + } + + /** + * Set the mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete'. + * + * @param mode the mode value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withMode(DeploymentMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the debug setting of the deployment. + * + * @return the debugSetting value + */ + public DebugSetting debugSetting() { + return this.debugSetting; + } + + /** + * Set the debug setting of the deployment. + * + * @param debugSetting the debugSetting value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDebugSetting(DebugSetting debugSetting) { + this.debugSetting = debugSetting; + return this; + } + + /** + * Get the deployment on error behavior. + * + * @return the onErrorDeployment value + */ + public OnErrorDeployment onErrorDeployment() { + return this.onErrorDeployment; + } + + /** + * Set the deployment on error behavior. + * + * @param onErrorDeployment the onErrorDeployment value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withOnErrorDeployment(OnErrorDeployment onErrorDeployment) { + this.onErrorDeployment = onErrorDeployment; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentPropertiesExtended.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentPropertiesExtended.java new file mode 100644 index 0000000000000..cbac744b508f7 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentPropertiesExtended.java @@ -0,0 +1,328 @@ +/** + * 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.resources.v2019_03_01; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ProviderInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment properties with additional details. + */ +public class DeploymentPropertiesExtended { + /** + * The state of the provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The correlation ID of the deployment. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /** + * The timestamp of the template deployment. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Key/value pairs that represent deployment output. + */ + @JsonProperty(value = "outputs") + private Object outputs; + + /** + * The list of resource providers needed for the deployment. + */ + @JsonProperty(value = "providers") + private List providers; + + /** + * The list of deployment dependencies. + */ + @JsonProperty(value = "dependencies") + private List dependencies; + + /** + * The template content. Use only one of Template or TemplateLink. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The URI referencing the template. Use only one of Template or + * TemplateLink. + */ + @JsonProperty(value = "templateLink") + private TemplateLink templateLink; + + /** + * Deployment parameters. Use only one of Parameters or ParametersLink. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * The URI referencing the parameters. Use only one of Parameters or + * ParametersLink. + */ + @JsonProperty(value = "parametersLink") + private ParametersLink parametersLink; + + /** + * The deployment mode. Possible values are Incremental and Complete. + * Possible values include: 'Incremental', 'Complete'. + */ + @JsonProperty(value = "mode") + private DeploymentMode mode; + + /** + * The debug setting of the deployment. + */ + @JsonProperty(value = "debugSetting") + private DebugSetting debugSetting; + + /** + * The deployment on error behavior. + */ + @JsonProperty(value = "onErrorDeployment") + private OnErrorDeploymentExtended onErrorDeployment; + + /** + * Get the state of the provisioning. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the correlation ID of the deployment. + * + * @return the correlationId value + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the timestamp of the template deployment. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get key/value pairs that represent deployment output. + * + * @return the outputs value + */ + public Object outputs() { + return this.outputs; + } + + /** + * Set key/value pairs that represent deployment output. + * + * @param outputs the outputs value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withOutputs(Object outputs) { + this.outputs = outputs; + return this; + } + + /** + * Get the list of resource providers needed for the deployment. + * + * @return the providers value + */ + public List providers() { + return this.providers; + } + + /** + * Set the list of resource providers needed for the deployment. + * + * @param providers the providers value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withProviders(List providers) { + this.providers = providers; + return this; + } + + /** + * Get the list of deployment dependencies. + * + * @return the dependencies value + */ + public List dependencies() { + return this.dependencies; + } + + /** + * Set the list of deployment dependencies. + * + * @param dependencies the dependencies value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withDependencies(List dependencies) { + this.dependencies = dependencies; + return this; + } + + /** + * Get the template content. Use only one of Template or TemplateLink. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. Use only one of Template or TemplateLink. + * + * @param template the template value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the URI referencing the template. Use only one of Template or TemplateLink. + * + * @return the templateLink value + */ + public TemplateLink templateLink() { + return this.templateLink; + } + + /** + * Set the URI referencing the template. Use only one of Template or TemplateLink. + * + * @param templateLink the templateLink value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withTemplateLink(TemplateLink templateLink) { + this.templateLink = templateLink; + return this; + } + + /** + * Get deployment parameters. Use only one of Parameters or ParametersLink. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set deployment parameters. Use only one of Parameters or ParametersLink. + * + * @param parameters the parameters value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the URI referencing the parameters. Use only one of Parameters or ParametersLink. + * + * @return the parametersLink value + */ + public ParametersLink parametersLink() { + return this.parametersLink; + } + + /** + * Set the URI referencing the parameters. Use only one of Parameters or ParametersLink. + * + * @param parametersLink the parametersLink value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withParametersLink(ParametersLink parametersLink) { + this.parametersLink = parametersLink; + return this; + } + + /** + * Get the deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete'. + * + * @return the mode value + */ + public DeploymentMode mode() { + return this.mode; + } + + /** + * Set the deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete'. + * + * @param mode the mode value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withMode(DeploymentMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the debug setting of the deployment. + * + * @return the debugSetting value + */ + public DebugSetting debugSetting() { + return this.debugSetting; + } + + /** + * Set the debug setting of the deployment. + * + * @param debugSetting the debugSetting value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withDebugSetting(DebugSetting debugSetting) { + this.debugSetting = debugSetting; + return this; + } + + /** + * Get the deployment on error behavior. + * + * @return the onErrorDeployment value + */ + public OnErrorDeploymentExtended onErrorDeployment() { + return this.onErrorDeployment; + } + + /** + * Set the deployment on error behavior. + * + * @param onErrorDeployment the onErrorDeployment value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withOnErrorDeployment(OnErrorDeploymentExtended onErrorDeployment) { + this.onErrorDeployment = onErrorDeployment; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentValidateResult.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentValidateResult.java new file mode 100644 index 0000000000000..e3ca8e46ae344 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/DeploymentValidateResult.java @@ -0,0 +1,30 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentValidateResultInner; + +/** + * Type representing DeploymentValidateResult. + */ +public interface DeploymentValidateResult extends HasInner, HasManager { + /** + * @return the error value. + */ + ResourceManagementErrorWithDetails error(); + + /** + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Deployments.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Deployments.java new file mode 100644 index 0000000000000..d3ffd78fc2f3f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Deployments.java @@ -0,0 +1,137 @@ +/** + * 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.resources.v2019_03_01; + +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.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.DeploymentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Deployments. + */ +public interface Deployments extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtSubscriptionScopeAsync(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAtSubscriptionScopeAsync(String deploymentName); + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtSubscriptionScopeAsync(String deploymentName); + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAtSubscriptionScopeAsync(String deploymentName); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment from which to get the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAtSubscriptionScopeAsync(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAsync(String resourceGroupName, String deploymentName); + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String deploymentName); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters); + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment from which to get the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAsync(String resourceGroupName, String deploymentName); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ExportTemplateRequest.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ExportTemplateRequest.java new file mode 100644 index 0000000000000..d0c373e867e79 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ExportTemplateRequest.java @@ -0,0 +1,74 @@ +/** + * 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.resources.v2019_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Export resource group template request parameters. + */ +public class ExportTemplateRequest { + /** + * The IDs of the resources. The only supported string currently is '*' + * (all resources). Future updates will support exporting specific + * resources. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * The export template options. Supported values include + * 'IncludeParameterDefaultValue', 'IncludeComments' or + * 'IncludeParameterDefaultValue, IncludeComments. + */ + @JsonProperty(value = "options") + private String options; + + /** + * Get the IDs of the resources. The only supported string currently is '*' (all resources). Future updates will support exporting specific resources. + * + * @return the resources value + */ + public List resources() { + return this.resources; + } + + /** + * Set the IDs of the resources. The only supported string currently is '*' (all resources). Future updates will support exporting specific resources. + * + * @param resources the resources value to set + * @return the ExportTemplateRequest object itself. + */ + public ExportTemplateRequest withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the export template options. Supported values include 'IncludeParameterDefaultValue', 'IncludeComments' or 'IncludeParameterDefaultValue, IncludeComments. + * + * @return the options value + */ + public String options() { + return this.options; + } + + /** + * Set the export template options. Supported values include 'IncludeParameterDefaultValue', 'IncludeComments' or 'IncludeParameterDefaultValue, IncludeComments. + * + * @param options the options value to set + * @return the ExportTemplateRequest object itself. + */ + public ExportTemplateRequest withOptions(String options) { + this.options = options; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResource.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResource.java new file mode 100644 index 0000000000000..694226b90dc9a --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResource.java @@ -0,0 +1,76 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.GenericResourceInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import java.util.Map; + +/** + * Type representing GenericResource. + */ +public interface GenericResource extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the plan value. + */ + Plan plan(); + + /** + * @return the properties value. + */ + Object properties(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResourceFilter.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResourceFilter.java new file mode 100644 index 0000000000000..9be7b9fef3a54 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/GenericResourceFilter.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource filter. + */ +public class GenericResourceFilter { + /** + * The resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The tag name. + */ + @JsonProperty(value = "tagname") + private String tagname; + + /** + * The tag value. + */ + @JsonProperty(value = "tagvalue") + private String tagvalue; + + /** + * Get the resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resource type. + * + * @param resourceType the resourceType value to set + * @return the GenericResourceFilter object itself. + */ + public GenericResourceFilter withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the tag name. + * + * @return the tagname value + */ + public String tagname() { + return this.tagname; + } + + /** + * Set the tag name. + * + * @param tagname the tagname value to set + * @return the GenericResourceFilter object itself. + */ + public GenericResourceFilter withTagname(String tagname) { + this.tagname = tagname; + return this; + } + + /** + * Get the tag value. + * + * @return the tagvalue value + */ + public String tagvalue() { + return this.tagvalue; + } + + /** + * Set the tag value. + * + * @param tagvalue the tagvalue value to set + * @return the GenericResourceFilter object itself. + */ + public GenericResourceFilter withTagvalue(String tagvalue) { + this.tagvalue = tagvalue; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/HttpMessage.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/HttpMessage.java new file mode 100644 index 0000000000000..c6d82a5c1ff24 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/HttpMessage.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP message. + */ +public class HttpMessage { + /** + * HTTP message content. + */ + @JsonProperty(value = "content") + private Object content; + + /** + * Get hTTP message content. + * + * @return the content value + */ + public Object content() { + return this.content; + } + + /** + * Set hTTP message content. + * + * @param content the content value to set + * @return the HttpMessage object itself. + */ + public HttpMessage withContent(Object content) { + this.content = content; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Identity.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Identity.java new file mode 100644 index 0000000000000..776838ffa6ab4 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Identity.java @@ -0,0 +1,103 @@ +/** + * 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.resources.v2019_03_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'SystemAssigned', + * 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + + /** + * Get the principal ID of resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of resource. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/IdentityUserAssignedIdentitiesValue.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/IdentityUserAssignedIdentitiesValue.java new file mode 100644 index 0000000000000..908c4e1b5fc75 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/IdentityUserAssignedIdentitiesValue.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The IdentityUserAssignedIdentitiesValue model. + */ +public class IdentityUserAssignedIdentitiesValue { + /** + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principal id of user assigned identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the client id of user assigned identity. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeployment.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeployment.java new file mode 100644 index 0000000000000..517111f34d8b1 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeployment.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment on error behavior. + */ +public class OnErrorDeployment { + /** + * The deployment on error behavior type. Possible values are + * LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment'. + */ + @JsonProperty(value = "type") + private OnErrorDeploymentType type; + + /** + * The deployment to be used on error case. + */ + @JsonProperty(value = "deploymentName") + private String deploymentName; + + /** + * Get the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @return the type value + */ + public OnErrorDeploymentType type() { + return this.type; + } + + /** + * Set the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @param type the type value to set + * @return the OnErrorDeployment object itself. + */ + public OnErrorDeployment withType(OnErrorDeploymentType type) { + this.type = type; + return this; + } + + /** + * Get the deployment to be used on error case. + * + * @return the deploymentName value + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Set the deployment to be used on error case. + * + * @param deploymentName the deploymentName value to set + * @return the OnErrorDeployment object itself. + */ + public OnErrorDeployment withDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentExtended.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentExtended.java new file mode 100644 index 0000000000000..5e3e2a5671a5a --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentExtended.java @@ -0,0 +1,86 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment on error behavior with additional details. + */ +public class OnErrorDeploymentExtended { + /** + * The state of the provisioning for the on error deployment. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The deployment on error behavior type. Possible values are + * LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment'. + */ + @JsonProperty(value = "type") + private OnErrorDeploymentType type; + + /** + * The deployment to be used on error case. + */ + @JsonProperty(value = "deploymentName") + private String deploymentName; + + /** + * Get the state of the provisioning for the on error deployment. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @return the type value + */ + public OnErrorDeploymentType type() { + return this.type; + } + + /** + * Set the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @param type the type value to set + * @return the OnErrorDeploymentExtended object itself. + */ + public OnErrorDeploymentExtended withType(OnErrorDeploymentType type) { + this.type = type; + return this; + } + + /** + * Get the deployment to be used on error case. + * + * @return the deploymentName value + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Set the deployment to be used on error case. + * + * @param deploymentName the deploymentName value to set + * @return the OnErrorDeploymentExtended object itself. + */ + public OnErrorDeploymentExtended withDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentType.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentType.java new file mode 100644 index 0000000000000..4bbe19436c3fb --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OnErrorDeploymentType.java @@ -0,0 +1,53 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OnErrorDeploymentType. + */ +public enum OnErrorDeploymentType { + /** Enum value LastSuccessful. */ + LAST_SUCCESSFUL("LastSuccessful"), + + /** Enum value SpecificDeployment. */ + SPECIFIC_DEPLOYMENT("SpecificDeployment"); + + /** The actual serialized value for a OnErrorDeploymentType instance. */ + private String value; + + OnErrorDeploymentType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnErrorDeploymentType instance. + * + * @param value the serialized value to parse. + * @return the parsed OnErrorDeploymentType object, or null if unable to parse. + */ + @JsonCreator + public static OnErrorDeploymentType fromString(String value) { + OnErrorDeploymentType[] items = OnErrorDeploymentType.values(); + for (OnErrorDeploymentType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operation.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operation.java new file mode 100644 index 0000000000000..4baf656786c08 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operation.java @@ -0,0 +1,30 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OperationDisplay.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OperationDisplay.java new file mode 100644 index 0000000000000..5b67973ee7529 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/OperationDisplay.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Resources. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.Resources. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Resources. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay 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 OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operations.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operations.java new file mode 100644 index 0000000000000..faf793215543f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.resources.v2019_03_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ParametersLink.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ParametersLink.java new file mode 100644 index 0000000000000..26a93078bc519 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ParametersLink.java @@ -0,0 +1,69 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Entity representing the reference to the deployment parameters. + */ +public class ParametersLink { + /** + * The URI of the parameters file. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /** + * If included, must match the ContentVersion in the template. + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /** + * Get the URI of the parameters file. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the parameters file. + * + * @param uri the uri value to set + * @return the ParametersLink object itself. + */ + public ParametersLink withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get if included, must match the ContentVersion in the template. + * + * @return the contentVersion value + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set if included, must match the ContentVersion in the template. + * + * @param contentVersion the contentVersion value to set + * @return the ParametersLink object itself. + */ + public ParametersLink withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Plan.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Plan.java new file mode 100644 index 0000000000000..b14353150b7ef --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Plan.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Plan for the resource. + */ +public class Plan { + /** + * The plan ID. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The publisher ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * The offer ID. + */ + @JsonProperty(value = "product") + private String product; + + /** + * The promotion code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /** + * The plan's version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the plan ID. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the plan ID. + * + * @param name the name value to set + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher ID. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher ID. + * + * @param publisher the publisher value to set + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer ID. + * + * @return the product value + */ + public String product() { + return this.product; + } + + /** + * Set the offer ID. + * + * @param product the product value to set + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotion code. + * + * @return the promotionCode value + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotion code. + * + * @param promotionCode the promotionCode value to set + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the plan's version. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the plan's version. + * + * @param version the version value to set + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Provider.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Provider.java new file mode 100644 index 0000000000000..53fd9d91bf158 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Provider.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ProviderInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import java.util.List; + +/** + * Type representing Provider. + */ +public interface Provider extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the namespace value. + */ + String namespace(); + + /** + * @return the registrationPolicy value. + */ + String registrationPolicy(); + + /** + * @return the registrationState value. + */ + String registrationState(); + + /** + * @return the resourceTypes value. + */ + List resourceTypes(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ProviderResourceType.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ProviderResourceType.java new file mode 100644 index 0000000000000..233087989e864 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ProviderResourceType.java @@ -0,0 +1,175 @@ +/** + * 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.resources.v2019_03_01; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource type managed by the resource provider. + */ +public class ProviderResourceType { + /** + * The resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The collection of locations where this resource type can be created. + */ + @JsonProperty(value = "locations") + private List locations; + + /** + * The aliases that are supported by this resource type. + */ + @JsonProperty(value = "aliases") + private List aliases; + + /** + * The API version. + */ + @JsonProperty(value = "apiVersions") + private List apiVersions; + + /** + * The additional capabilities offered by this resource type. + */ + @JsonProperty(value = "capabilities") + private String capabilities; + + /** + * The properties. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Get the resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resource type. + * + * @param resourceType the resourceType value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the collection of locations where this resource type can be created. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set the collection of locations where this resource type can be created. + * + * @param locations the locations value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the aliases that are supported by this resource type. + * + * @return the aliases value + */ + public List aliases() { + return this.aliases; + } + + /** + * Set the aliases that are supported by this resource type. + * + * @param aliases the aliases value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withAliases(List aliases) { + this.aliases = aliases; + return this; + } + + /** + * Get the API version. + * + * @return the apiVersions value + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Set the API version. + * + * @param apiVersions the apiVersions value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withApiVersions(List apiVersions) { + this.apiVersions = apiVersions; + return this; + } + + /** + * Get the additional capabilities offered by this resource type. + * + * @return the capabilities value + */ + public String capabilities() { + return this.capabilities; + } + + /** + * Set the additional capabilities offered by this resource type. + * + * @param capabilities the capabilities value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withCapabilities(String capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the properties. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties. + * + * @param properties the properties value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withProperties(Map properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Providers.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Providers.java new file mode 100644 index 0000000000000..572d77c623999 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Providers.java @@ -0,0 +1,54 @@ +/** + * 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.resources.v2019_03_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ProvidersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Providers. + */ +public interface Providers extends HasInner { + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable unregisterAsync(String resourceProviderNamespace); + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable registerAsync(String resourceProviderNamespace); + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceProviderNamespace); + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroup.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroup.java new file mode 100644 index 0000000000000..ba3147e5376ae --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroup.java @@ -0,0 +1,203 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourceGroupInner; +import com.microsoft.azure.arm.model.Indexable; +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.resources.v2019_03_01.implementation.ResourcesManager; +import java.util.Map; + +/** + * Type representing ResourceGroup. + */ +public interface ResourceGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + ResourceGroupProperties properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ResourceGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSubscription, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ResourceGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ResourceGroup definition. + */ + interface Blank extends WithSubscription { + } + + /** + * The stage of the resourcegroup definition allowing to specify Subscription. + */ + interface WithSubscription { + /** + * Specifies . + * @return the next definition stage + */ + WithLocation withExistingSubscription(); + } + + /** + * The stage of the resourcegroup definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the resourcegroup definition allowing to specify ManagedBy. + */ + interface WithManagedBy { + /** + * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next definition stage + */ + WithCreate withManagedBy(String managedBy); + } + + /** + * The stage of the resourcegroup definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties the properties parameter value + * @return the next definition stage + */ + WithCreate withProperties(ResourceGroupProperties properties); + } + + /** + * The stage of the resourcegroup definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * 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.WithManagedBy, DefinitionStages.WithProperties, DefinitionStages.WithTags { + } + } + /** + * The template for a ResourceGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithManagedBy, UpdateStages.WithName, UpdateStages.WithProperties, UpdateStages.WithTags { + } + + /** + * Grouping of ResourceGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the resourcegroup update allowing to specify ManagedBy. + */ + interface WithManagedBy { + /** + * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next update stage + */ + Update withManagedBy(String managedBy); + } + + /** + * The stage of the resourcegroup update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name The name of the resource group + * @return the next update stage + */ + Update withName(String name); + } + + /** + * The stage of the resourcegroup update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties the properties parameter value + * @return the next update stage + */ + Update withProperties(ResourceGroupProperties properties); + } + + /** + * The stage of the resourcegroup update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags attached to the resource group + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupExportResult.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupExportResult.java new file mode 100644 index 0000000000000..c1c49fb5e95e3 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupExportResult.java @@ -0,0 +1,30 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourceGroupExportResultInner; + +/** + * Type representing ResourceGroupExportResult. + */ +public interface ResourceGroupExportResult extends HasInner, HasManager { + /** + * @return the error value. + */ + ResourceManagementErrorWithDetails error(); + + /** + * @return the template value. + */ + Object template(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupFilter.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupFilter.java new file mode 100644 index 0000000000000..152e51c9fce97 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupFilter.java @@ -0,0 +1,69 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group filter. + */ +public class ResourceGroupFilter { + /** + * The tag name. + */ + @JsonProperty(value = "tagName") + private String tagName; + + /** + * The tag value. + */ + @JsonProperty(value = "tagValue") + private String tagValue; + + /** + * Get the tag name. + * + * @return the tagName value + */ + public String tagName() { + return this.tagName; + } + + /** + * Set the tag name. + * + * @param tagName the tagName value to set + * @return the ResourceGroupFilter object itself. + */ + public ResourceGroupFilter withTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Get the tag value. + * + * @return the tagValue value + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tag value. + * + * @param tagValue the tagValue value to set + * @return the ResourceGroupFilter object itself. + */ + public ResourceGroupFilter withTagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupPatchable.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupPatchable.java new file mode 100644 index 0000000000000..fc206725e035b --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupPatchable.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.resources.v2019_03_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group information. + */ +public class ResourceGroupPatchable { + /** + * The name of the resource group. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private ResourceGroupProperties properties; + + /** + * The ID of the resource that manages this resource group. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * The tags attached to the resource group. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the name of the resource group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the resource group. + * + * @param name the name value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public ResourceGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withProperties(ResourceGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the ID of the resource that manages this resource group. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the ID of the resource that manages this resource group. + * + * @param managedBy the managedBy value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the tags attached to the resource group. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags attached to the resource group. + * + * @param tags the tags value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupProperties.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupProperties.java new file mode 100644 index 0000000000000..612985aef7ebb --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroupProperties.java @@ -0,0 +1,32 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource group properties. + */ +public class ResourceGroupProperties { + /** + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioning state. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroups.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroups.java new file mode 100644 index 0000000000000..0992e373e44ad --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceGroups.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. + */ + +package com.microsoft.azure.management.resources.v2019_03_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourceGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ResourceGroups. + */ +public interface ResourceGroups extends SupportsCreating, HasInner { + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAsync(String resourceGroupName); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters); + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName); + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceIdentityType.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceIdentityType.java new file mode 100644 index 0000000000000..ca4411909a8f7 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceIdentityType.java @@ -0,0 +1,59 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceManagementErrorWithDetails.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceManagementErrorWithDetails.java new file mode 100644 index 0000000000000..ca24877b5548e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceManagementErrorWithDetails.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. + */ + +package com.microsoft.azure.management.resources.v2019_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The detailed error message of resource management. + */ +public class ResourceManagementErrorWithDetails { + /** + * The error code returned when exporting the template. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message describing the export error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Validation error. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * Get the error code returned when exporting the template. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message describing the export error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get validation error. + * + * @return the details value + */ + public List details() { + return this.details; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceProviderOperationDisplayProperties.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceProviderOperationDisplayProperties.java new file mode 100644 index 0000000000000..e86ef7f04e8d5 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourceProviderOperationDisplayProperties.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource provider operation's display properties. + */ +public class ResourceProviderOperationDisplayProperties { + /** + * Operation description. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * Operation provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Operation resource. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Resource provider operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get operation description. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set operation description. + * + * @param publisher the publisher value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get operation provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set operation provider. + * + * @param provider the provider value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get operation resource. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set operation resource. + * + * @param resource the resource value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get resource provider operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set resource provider operation. + * + * @param operation the operation value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation description. + * + * @param description the description value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Resources.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Resources.java new file mode 100644 index 0000000000000..277a28a4ee086 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Resources.java @@ -0,0 +1,184 @@ +/** + * 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.resources.v2019_03_01; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.GenericResourceInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Resources. + */ +public interface Resources extends HasInner { + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceByIdAsync(String resourceId, String apiVersion); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteByIdAsync(String resourceId, String apiVersion); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String resourceId, String apiVersion); + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters); + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourcesMoveInfo.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourcesMoveInfo.java new file mode 100644 index 0000000000000..5682cdaae71c3 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/ResourcesMoveInfo.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.resources.v2019_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters of move resources. + */ +public class ResourcesMoveInfo { + /** + * The IDs of the resources. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * The target resource group. + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /** + * Get the IDs of the resources. + * + * @return the resources value + */ + public List resources() { + return this.resources; + } + + /** + * Set the IDs of the resources. + * + * @param resources the resources value to set + * @return the ResourcesMoveInfo object itself. + */ + public ResourcesMoveInfo withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the target resource group. + * + * @return the targetResourceGroup value + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the target resource group. + * + * @param targetResourceGroup the targetResourceGroup value to set + * @return the ResourcesMoveInfo object itself. + */ + public ResourcesMoveInfo withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Sku.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Sku.java new file mode 100644 index 0000000000000..be71cc355c78d --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Sku.java @@ -0,0 +1,173 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU for the resource. + */ +public class Sku { + /** + * The SKU name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The SKU tier. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. + */ + @JsonProperty(value = "size") + private String size; + + /** + * The SKU family. + */ + @JsonProperty(value = "family") + private String family; + + /** + * The SKU model. + */ + @JsonProperty(value = "model") + private String model; + + /** + * The SKU capacity. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the SKU name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the SKU name. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the SKU tier. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the SKU tier. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. + * + * @param size the size value to set + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the SKU family. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set the SKU family. + * + * @param family the family value to set + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the SKU model. + * + * @return the model value + */ + public String model() { + return this.model; + } + + /** + * Set the SKU model. + * + * @param model the model value to set + * @return the Sku object itself. + */ + public Sku withModel(String model) { + this.model = model; + return this; + } + + /** + * Get the SKU capacity. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the SKU capacity. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagCount.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagCount.java new file mode 100644 index 0000000000000..8b107f7d55e17 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagCount.java @@ -0,0 +1,69 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tag count. + */ +public class TagCount { + /** + * Type of count. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Value of count. + */ + @JsonProperty(value = "value") + private Integer value; + + /** + * Get type of count. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set type of count. + * + * @param type the type value to set + * @return the TagCount object itself. + */ + public TagCount withType(String type) { + this.type = type; + return this; + } + + /** + * Get value of count. + * + * @return the value value + */ + public Integer value() { + return this.value; + } + + /** + * Set value of count. + * + * @param value the value value to set + * @return the TagCount object itself. + */ + public TagCount withValue(Integer value) { + this.value = value; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagDetails.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagDetails.java new file mode 100644 index 0000000000000..2bcbccf5ebdfa --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagDetails.java @@ -0,0 +1,41 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.TagDetailsInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import java.util.List; + +/** + * Type representing TagDetails. + */ +public interface TagDetails extends HasInner, HasManager { + /** + * @return the count value. + */ + TagCount count(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the tagName value. + */ + String tagName(); + + /** + * @return the values value. + */ + List values(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagValue.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagValue.java new file mode 100644 index 0000000000000..8c73ce57ba676 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TagValue.java @@ -0,0 +1,35 @@ +/** + * 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.resources.v2019_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_03_01.implementation.TagValueInner; + +/** + * Type representing TagValue. + */ +public interface TagValue extends HasInner, HasManager { + /** + * @return the count value. + */ + TagCount count(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the tagValue value. + */ + String tagValue(); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Tags.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Tags.java new file mode 100644 index 0000000000000..ddf93c4b5f744 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/Tags.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. + */ + +package com.microsoft.azure.management.resources.v2019_03_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.TagDetails; +import rx.Completable; + +/** + * Type representing Tags. + */ +public interface Tags { + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String tagName); + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String tagName); + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteValueAsync(String tagName, String tagValue); + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateValueAsync(String tagName, String tagValue); + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TargetResource.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TargetResource.java new file mode 100644 index 0000000000000..641dc0237518e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TargetResource.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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Target resource. + */ +public class TargetResource { + /** + * The ID of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The name of the resource. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * The type of the resource. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Get the ID of the resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the resource. + * + * @param id the id value to set + * @return the TargetResource object itself. + */ + public TargetResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name of the resource. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the name of the resource. + * + * @param resourceName the resourceName value to set + * @return the TargetResource object itself. + */ + public TargetResource withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the type of the resource. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the type of the resource. + * + * @param resourceType the resourceType value to set + * @return the TargetResource object itself. + */ + public TargetResource withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TemplateLink.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TemplateLink.java new file mode 100644 index 0000000000000..782e6b0c474eb --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/TemplateLink.java @@ -0,0 +1,69 @@ +/** + * 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.resources.v2019_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Entity representing the reference to the template. + */ +public class TemplateLink { + /** + * The URI of the template to deploy. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /** + * If included, must match the ContentVersion in the template. + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /** + * Get the URI of the template to deploy. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the template to deploy. + * + * @param uri the uri value to set + * @return the TemplateLink object itself. + */ + public TemplateLink withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get if included, must match the ContentVersion in the template. + * + * @return the contentVersion value + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set if included, must match the ContentVersion in the template. + * + * @param contentVersion the contentVersion value to set + * @return the TemplateLink object itself. + */ + public TemplateLink withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultImpl.java new file mode 100644 index 0000000000000..d7cdfe4043fd7 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentExportResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DeploymentExportResultImpl extends WrapperImpl implements DeploymentExportResult { + private final ResourcesManager manager; + DeploymentExportResultImpl(DeploymentExportResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Object template() { + return this.inner().template(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultInner.java new file mode 100644 index 0000000000000..b8767c00dabc7 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExportResultInner.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.resources.v2019_03_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The deployment export result. + */ +public class DeploymentExportResultInner { + /** + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * Get the template content. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. + * + * @param template the template value to set + * @return the DeploymentExportResultInner object itself. + */ + public DeploymentExportResultInner withTemplate(Object template) { + this.template = template; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedImpl.java new file mode 100644 index 0000000000000..a994133c8b700 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedImpl.java @@ -0,0 +1,137 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentExtended; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentProperties; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentPropertiesExtended; +import rx.functions.Func1; + +class DeploymentExtendedImpl extends CreatableUpdatableImpl implements DeploymentExtended, DeploymentExtended.Definition, DeploymentExtended.Update { + private String resourceGroupName; + private String deploymentName; + private DeploymentInner createOrUpdateParameter; + private final ResourcesManager manager; + + DeploymentExtendedImpl(String name, ResourcesManager manager) { + super(name, new DeploymentExtendedInner()); + this.manager = manager; + // Set resource name + this.deploymentName = name; + // + this.createOrUpdateParameter = new DeploymentInner(); + } + + DeploymentExtendedImpl(DeploymentExtendedInner inner, ResourcesManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.deploymentName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.deploymentName = IdParsingUtils.getValueFromIdByName(inner.id(), "deployments"); + // set other parameters for create and update + this.createOrUpdateParameter = new DeploymentInner(); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.deploymentName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public DeploymentExtendedInner call(DeploymentExtendedInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.deploymentName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public DeploymentExtendedInner call(DeploymentExtendedInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return client.getByResourceGroupAsync(this.resourceGroupName, this.deploymentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new DeploymentInner(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DeploymentPropertiesExtended properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DeploymentExtendedImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public DeploymentExtendedImpl withProperties(DeploymentProperties properties) { + this.createOrUpdateParameter.withProperties(properties); + return this; + } + + @Override + public DeploymentExtendedImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedInner.java new file mode 100644 index 0000000000000..d37f89d2b7214 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentExtendedInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * Deployment information. + */ +public class DeploymentExtendedInner extends ProxyResource { + /** + * the location of the deployment. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get the location of the deployment. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the deployment. + * + * @param location the location value to set + * @return the DeploymentExtendedInner object itself. + */ + public DeploymentExtendedInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get deployment properties. + * + * @return the properties value + */ + public DeploymentPropertiesExtended properties() { + return this.properties; + } + + /** + * Set deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentExtendedInner object itself. + */ + public DeploymentExtendedInner withProperties(DeploymentPropertiesExtended properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentInner.java new file mode 100644 index 0000000000000..5e266904d39c4 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentInner.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation parameters. + */ +public class DeploymentInner { + /** + * The location to store the deployment data. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentProperties properties; + + /** + * Get the location to store the deployment data. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location to store the deployment data. + * + * @param location the location value to set + * @return the DeploymentInner object itself. + */ + public DeploymentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the deployment properties. + * + * @return the properties value + */ + public DeploymentProperties properties() { + return this.properties; + } + + /** + * Set the deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentInner object itself. + */ + public DeploymentInner withProperties(DeploymentProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationImpl.java new file mode 100644 index 0000000000000..e6f57d7043b3e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationImpl.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperation; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperationProperties; + +class DeploymentOperationImpl extends IndexableRefreshableWrapperImpl implements DeploymentOperation { + private final ResourcesManager manager; + private String deploymentName; + private String operationId; + + DeploymentOperationImpl(DeploymentOperationInner inner, ResourcesManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.deploymentName = IdParsingUtils.getValueFromIdByName(inner.id(), "deployments"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operations"); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DeploymentOperationsInner client = this.manager().inner().deploymentOperations(); + return client.getAtSubscriptionScopeAsync(this.deploymentName, this.operationId); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String operationId() { + return this.inner().operationId(); + } + + @Override + public DeploymentOperationProperties properties() { + return this.inner().properties(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationInner.java new file mode 100644 index 0000000000000..f75697bc3e9bb --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationInner.java @@ -0,0 +1,74 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation information. + */ +public class DeploymentOperationInner { + /** + * Full deployment operation ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Deployment operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /** + * Deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentOperationProperties properties; + + /** + * Get full deployment operation ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get deployment operation ID. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Get deployment properties. + * + * @return the properties value + */ + public DeploymentOperationProperties properties() { + return this.properties; + } + + /** + * Set deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentOperationInner object itself. + */ + public DeploymentOperationInner withProperties(DeploymentOperationProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsImpl.java new file mode 100644 index 0000000000000..b913fc4a841b3 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsImpl.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperation; + +class DeploymentOperationsImpl extends WrapperImpl implements DeploymentOperations { + private final ResourcesManager manager; + + DeploymentOperationsImpl(ResourcesManager manager) { + super(manager.inner().deploymentOperations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private DeploymentOperationImpl wrapModel(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAsync(resourceGroupName, deploymentName, operationId) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName, final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName, deploymentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAtSubscriptionScopeAsync(final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listAtSubscriptionScopeAsync(deploymentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAtSubscriptionScopeAsync(String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAtSubscriptionScopeAsync(deploymentName, operationId) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsInner.java new file mode 100644 index 0000000000000..90b80cd5a0c3e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentOperationsInner.java @@ -0,0 +1,961 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DeploymentOperations. + */ +public class DeploymentOperationsInner { + /** The Retrofit service to perform REST calls. */ + private DeploymentOperationsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of DeploymentOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DeploymentOperationsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(DeploymentOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DeploymentOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface DeploymentOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperations getAtSubscriptionScope" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + Observable> getAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperations listAtSubscriptionScope" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + Observable> listAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.resources.v2019_03_01.DeploymentOperations get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.resources.v2019_03_01.DeploymentOperations listAtSubscriptionScopeNext" }) + @GET + Observable> listAtSubscriptionScopeNext(@Url String nextUrl, @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.resources.v2019_03_01.DeploymentOperations listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @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 DeploymentOperationInner object if successful. + */ + public DeploymentOperationInner getAtSubscriptionScope(String deploymentName, String operationId) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName, operationId).toBlocking().single().body(); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @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 getAtSubscriptionScopeAsync(String deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionScopeWithServiceResponseAsync(deploymentName, operationId), serviceCallback); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable getAtSubscriptionScopeAsync(String deploymentName, String operationId) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName, operationId).map(new Func1, DeploymentOperationInner>() { + @Override + public DeploymentOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable> getAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, String operationId) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtSubscriptionScope(deploymentName, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtSubscriptionScopeDelegate(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); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @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 PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtSubscriptionScope(final String deploymentName) { + ServiceResponse> response = listAtSubscriptionScopeSinglePageAsync(deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @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> listAtSubscriptionScopeAsync(final String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtSubscriptionScopeSinglePageAsync(deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtSubscriptionScopeAsync(final String deploymentName) { + return listAtSubscriptionScopeWithServiceResponseAsync(deploymentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtSubscriptionScopeWithServiceResponseAsync(final String deploymentName) { + return listAtSubscriptionScopeSinglePageAsync(deploymentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtSubscriptionScopeSinglePageAsync(final String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + return service.listAtSubscriptionScope(deploymentName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtSubscriptionScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @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 PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtSubscriptionScope(final String deploymentName, final Integer top) { + ServiceResponse> response = listAtSubscriptionScopeSinglePageAsync(deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @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> listAtSubscriptionScopeAsync(final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtSubscriptionScopeSinglePageAsync(deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtSubscriptionScopeAsync(final String deploymentName, final Integer top) { + return listAtSubscriptionScopeWithServiceResponseAsync(deploymentName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtSubscriptionScopeWithServiceResponseAsync(final String deploymentName, final Integer top) { + return listAtSubscriptionScopeSinglePageAsync(deploymentName, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param deploymentName The name of the deployment with the operation to get. + ServiceResponse> * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtSubscriptionScopeSinglePageAsync(final String deploymentName, final Integer top) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAtSubscriptionScope(deploymentName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtSubscriptionScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtSubscriptionScopeDelegate(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); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @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 DeploymentOperationInner object if successful. + */ + public DeploymentOperationInner get(String resourceGroupName, String deploymentName, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId).toBlocking().single().body(); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @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 deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId), serviceCallback); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable getAsync(String resourceGroupName, String deploymentName, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId).map(new Func1, DeploymentOperationInner>() { + @Override + public DeploymentOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String deploymentName, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, deploymentName, operationId, this.client.subscriptionId(), 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); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @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 PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String deploymentName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @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> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String deploymentName) { + return listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, deploymentName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @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 PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String deploymentName, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @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> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment with the operation to get. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String deploymentName, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param deploymentName The name of the deployment with the operation to get. + ServiceResponse> * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String deploymentName, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, deploymentName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtSubscriptionScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listAtSubscriptionScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtSubscriptionScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtSubscriptionScopeNextAsync(final String nextPageLink) { + return listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtSubscriptionScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtSubscriptionScopeNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listAtSubscriptionScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtSubscriptionScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtSubscriptionScopeNextDelegate(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); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultImpl.java new file mode 100644 index 0000000000000..70768aa0cfb3e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultImpl.java @@ -0,0 +1,38 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentValidateResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceManagementErrorWithDetails; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentPropertiesExtended; + +class DeploymentValidateResultImpl extends WrapperImpl implements DeploymentValidateResult { + private final ResourcesManager manager; + DeploymentValidateResultImpl(DeploymentValidateResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public ResourceManagementErrorWithDetails error() { + return this.inner().error(); + } + + @Override + public DeploymentPropertiesExtended properties() { + return this.inner().properties(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultInner.java new file mode 100644 index 0000000000000..1b28049b20311 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentValidateResultInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.ResourceManagementErrorWithDetails; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information from validate template deployment response. + */ +public class DeploymentValidateResultInner { + /** + * Validation error. + */ + @JsonProperty(value = "error") + private ResourceManagementErrorWithDetails error; + + /** + * The template deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get validation error. + * + * @return the error value + */ + public ResourceManagementErrorWithDetails error() { + return this.error; + } + + /** + * Set validation error. + * + * @param error the error value to set + * @return the DeploymentValidateResultInner object itself. + */ + public DeploymentValidateResultInner withError(ResourceManagementErrorWithDetails error) { + this.error = error; + return this; + } + + /** + * Get the template deployment properties. + * + * @return the properties value + */ + public DeploymentPropertiesExtended properties() { + return this.properties; + } + + /** + * Set the template deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentValidateResultInner object itself. + */ + public DeploymentValidateResultInner withProperties(DeploymentPropertiesExtended properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsImpl.java new file mode 100644 index 0000000000000..8507ea3e8dc57 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsImpl.java @@ -0,0 +1,285 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.Deployments; +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.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentExtended; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentValidateResult; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentExportResult; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class DeploymentsImpl extends WrapperImpl implements Deployments { + private PagedListConverter converter; + private final ResourcesManager manager; + + DeploymentsImpl(ResourcesManager manager) { + super(manager.inner().deployments()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(DeploymentExtendedInner inner) { + return Observable.just((DeploymentExtended) wrapModel(inner)); + } + }; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public DeploymentExtendedImpl define(String name) { + return wrapModel(name); + } + + private DeploymentExtendedImpl wrapModel(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + + private DeploymentExtendedImpl wrapModel(String name) { + return new DeploymentExtendedImpl(name, this.manager()); + } + + @Override + public Completable deleteAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.deleteAtSubscriptionScopeAsync(deploymentName).toCompletable(); + } + + @Override + public Observable checkExistenceAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAtSubscriptionScopeAsync(deploymentName) + ;} + + @Override + public Observable createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.createOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.getAtSubscriptionScopeAsync(deploymentName) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable cancelAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAtSubscriptionScopeAsync(deploymentName).toCompletable(); + } + + @Override + public Observable validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.validateAtSubscriptionScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAtSubscriptionScopeAsync(deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkExistenceAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName, deploymentName) + ;} + + @Override + public Completable cancelAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, deploymentName).toCompletable(); + } + + @Override + public Observable validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.validateAsync(resourceGroupName, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAsync(resourceGroupName, deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + DeploymentsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + DeploymentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + DeploymentsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + DeploymentsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return wrapModel(inner); + } + }); + } + + private Observable getInnerAsync(String resourceGroupName, String name) { + DeploymentsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + public DeploymentExtended getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupAsync(resourceGroupName, name).toBlocking().last(); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return this.getInnerAsync(resourceGroupName, name).map(new Func1 () { + @Override + public DeploymentExtended call(DeploymentExtendedInner innerT) { + return wrapModel(innerT); + } + }); + } + + @Override + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback callback) { + return ServiceFuture.fromBody(getByResourceGroupAsync(resourceGroupName, name), callback); + } + + @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 void deleteByResourceGroup(String resourceGroupName, String name) { + this.deleteByResourceGroupAsync(resourceGroupName, name).await(); + } + + @Override + public Completable deleteByResourceGroupAsync(String resourceGroupName, String name) { + return this.inner().deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public ServiceFuture deleteByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback serviceCallback) { + return ServiceFuture.fromBody(deleteByResourceGroupAsync(resourceGroupName, name), serviceCallback); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsInner.java new file mode 100644 index 0000000000000..f73d7088a4d98 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/DeploymentsInner.java @@ -0,0 +1,2342 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Deployments. + */ +public class DeploymentsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private DeploymentsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of DeploymentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DeploymentsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(DeploymentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Deployments to be + * used by Retrofit to perform actually REST calls. + */ + interface DeploymentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments deleteAtSubscriptionScope" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> deleteAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments beginDeleteAtSubscriptionScope" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDeleteAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments checkExistenceAtSubscriptionScope" }) + @HEAD("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistenceAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments createOrUpdateAtSubscriptionScope" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner parameters, @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.resources.v2019_03_01.Deployments beginCreateOrUpdateAtSubscriptionScope" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner parameters, @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.resources.v2019_03_01.Deployments getAtSubscriptionScope" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments cancelAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancelAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments validateAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner parameters, @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.resources.v2019_03_01.Deployments exportTemplateAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_03_01.Deployments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments checkExistence" }) + @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner parameters, @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.resources.v2019_03_01.Deployments beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner parameters, @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.resources.v2019_03_01.Deployments getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments cancel" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments validate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner parameters, @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.resources.v2019_03_01.Deployments exportTemplate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Deployments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_03_01.Deployments listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.resources.v2019_03_01.Deployments listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @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 + */ + public void deleteAtSubscriptionScope(String deploymentName) { + deleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().last().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @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 deleteAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAtSubscriptionScopeAsync(String deploymentName) { + return deleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @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 + */ + public void beginDeleteAtSubscriptionScope(String deploymentName) { + beginDeleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @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 beginDeleteAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAtSubscriptionScopeAsync(String deploymentName) { + return beginDeleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDeleteAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment to check. + * @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 boolean object if successful. + */ + public boolean checkExistenceAtSubscriptionScope(String deploymentName) { + return checkExistenceAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment to check. + * @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 checkExistenceAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAtSubscriptionScopeAsync(String deploymentName) { + return checkExistenceAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.checkExistenceAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner createOrUpdateAtSubscriptionScope(String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentInner parameters) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + Observable> observable = service.createOrUpdateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner beginCreateOrUpdateAtSubscriptionScope(String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 beginCreateOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable beginCreateOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentInner parameters) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.beginCreateOrUpdateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment to get. + * @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 DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner getAtSubscriptionScope(String deploymentName) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment to get. + * @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 getAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable getAtSubscriptionScopeAsync(String deploymentName) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> getAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtSubscriptionScopeDelegate(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); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment to cancel. + * @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 + */ + public void cancelAtSubscriptionScope(String deploymentName) { + cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment to cancel. + * @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 cancelAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAtSubscriptionScopeAsync(String deploymentName) { + return cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 DeploymentValidateResultInner object if successful. + */ + public DeploymentValidateResultInner validateAtSubscriptionScope(String deploymentName, DeploymentInner parameters) { + return validateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + return validateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentValidateResultInner>() { + @Override + public DeploymentValidateResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable> validateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentInner parameters) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.validateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment from which to get the template. + * @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 DeploymentExportResultInner object if successful. + */ + public DeploymentExportResultInner exportTemplateAtSubscriptionScope(String deploymentName) { + return exportTemplateAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment from which to get the template. + * @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 exportTemplateAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment from which to get the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable exportTemplateAtSubscriptionScopeAsync(String deploymentName) { + return exportTemplateAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, DeploymentExportResultInner>() { + @Override + public DeploymentExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment from which to get the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable> exportTemplateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.exportTemplateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateAtSubscriptionScopeDelegate(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); + } + + /** + * Get all the deployments for a subscription. + * + * @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 PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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."); + } + final String filter = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList list(final String filter, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAsync(final String filter, final Integer top) { + return listWithServiceResponseAsync(filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top) { + return listSinglePageAsync(filter, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + ServiceResponse> * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top) { + 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(), filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @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 + */ + public void delete(String resourceGroupName, String deploymentName) { + deleteWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().last().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @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 deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String deploymentName) { + return deleteWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @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 + */ + public void beginDelete(String resourceGroupName, String deploymentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @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 beginDeleteAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String deploymentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment to check. + * @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 boolean object if successful. + */ + public boolean checkExistence(String resourceGroupName, String deploymentName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment to check. + * @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 checkExistenceAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAsync(String resourceGroupName, String deploymentName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.checkExistence(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner createOrUpdate(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner beginCreateOrUpdate(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.beginCreateOrUpdate(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to get. + * @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 DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner getByResourceGroup(String resourceGroupName, String deploymentName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to get. + * @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 deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String deploymentName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, deploymentName, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to cancel. + * @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 + */ + public void cancel(String resourceGroupName, String deploymentName) { + cancelWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to cancel. + * @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 cancelAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String deploymentName) { + return cancelWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancel(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 DeploymentValidateResultInner object if successful. + */ + public DeploymentValidateResultInner validate(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return validateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return validateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, DeploymentValidateResultInner>() { + @Override + public DeploymentValidateResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable> validateWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.validate(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment from which to get the template. + * @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 DeploymentExportResultInner object if successful. + */ + public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment from which to get the template. + * @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 exportTemplateAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment from which to get the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable exportTemplateAsync(String resourceGroupName, String deploymentName) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, DeploymentExportResultInner>() { + @Override + public DeploymentExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment from which to get the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable> exportTemplateWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.exportTemplate(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateDelegate(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); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @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 PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + ServiceResponse> * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + ServiceResponse> * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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 all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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 all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceImpl.java new file mode 100644 index 0000000000000..f6ab2ba4e79fd --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.GenericResource; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.Identity; +import com.microsoft.azure.management.resources.v2019_03_01.Plan; +import com.microsoft.azure.management.resources.v2019_03_01.Sku; +import java.util.Map; + +class GenericResourceImpl extends WrapperImpl implements GenericResource { + private final ResourcesManager manager; + + GenericResourceImpl(GenericResourceInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Plan plan() { + return this.inner().plan(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceInner.java new file mode 100644 index 0000000000000..e3de9801f8017 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/GenericResourceInner.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.Plan; +import com.microsoft.azure.management.resources.v2019_03_01.Sku; +import com.microsoft.azure.management.resources.v2019_03_01.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Resource information. + */ +@SkipParentValidation +public class GenericResourceInner extends Resource { + /** + * The plan of the resource. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** + * The resource properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * The kind of the resource. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * ID of the resource that manages this resource. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * The SKU of the resource. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the plan of the resource. + * + * @return the plan value + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan of the resource. + * + * @param plan the plan value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the resource properties. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the resource properties. + * + * @param properties the properties value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the kind of the resource. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind of the resource. + * + * @param kind the kind value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get iD of the resource that manages this resource. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set iD of the resource that manages this resource. + * + * @param managedBy the managedBy value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the SKU of the resource. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the resource. + * + * @param sku the sku value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity of the resource. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity of the resource. + * + * @param identity the identity value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/IdParsingUtils.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..98d4d44f64d78 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/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.resources.v2019_03_01.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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..25c72b367d5f9 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ResourcesManager manager; + OperationImpl(OperationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..885e1f1e1e952 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationInner.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Resources operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..347622da85d1c --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_03_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ResourcesManager manager; + + OperationsImpl(ResourcesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..d89731855c046 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.http.Url; +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 ResourceManagementClientImpl 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, ResourceManagementClientImpl 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.resources.v2019_03_01.Operations list" }) + @GET("providers/Microsoft.Resources/operations") + Observable> list(@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.resources.v2019_03_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/PageImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..376879c240b0e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/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.resources.v2019_03_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderImpl.java new file mode 100644 index 0000000000000..2b16ba89238b5 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderImpl.java @@ -0,0 +1,66 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.Provider; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_03_01.ProviderResourceType; + +class ProviderImpl extends IndexableRefreshableWrapperImpl implements Provider { + private final ResourcesManager manager; + private String resourceProviderNamespace; + + ProviderImpl(ProviderInner inner, ResourcesManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceProviderNamespace = IdParsingUtils.getValueFromIdByName(inner.id(), "providers"); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ProvidersInner client = this.manager().inner().providers(); + return client.getAsync(this.resourceProviderNamespace); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String namespace() { + return this.inner().namespace(); + } + + @Override + public String registrationPolicy() { + return this.inner().registrationPolicy(); + } + + @Override + public String registrationState() { + return this.inner().registrationState(); + } + + @Override + public List resourceTypes() { + return this.inner().resourceTypes(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderInner.java new file mode 100644 index 0000000000000..f54fea2bdf620 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProviderInner.java @@ -0,0 +1,105 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.resources.v2019_03_01.ProviderResourceType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource provider information. + */ +public class ProviderInner { + /** + * The provider ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The namespace of the resource provider. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /** + * The registration state of the resource provider. + */ + @JsonProperty(value = "registrationState", access = JsonProperty.Access.WRITE_ONLY) + private String registrationState; + + /** + * The registration policy of the resource provider. + */ + @JsonProperty(value = "registrationPolicy", access = JsonProperty.Access.WRITE_ONLY) + private String registrationPolicy; + + /** + * The collection of provider resource types. + */ + @JsonProperty(value = "resourceTypes", access = JsonProperty.Access.WRITE_ONLY) + private List resourceTypes; + + /** + * Get the provider ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the namespace of the resource provider. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace of the resource provider. + * + * @param namespace the namespace value to set + * @return the ProviderInner object itself. + */ + public ProviderInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the registration state of the resource provider. + * + * @return the registrationState value + */ + public String registrationState() { + return this.registrationState; + } + + /** + * Get the registration policy of the resource provider. + * + * @return the registrationPolicy value + */ + public String registrationPolicy() { + return this.registrationPolicy; + } + + /** + * Get the collection of provider resource types. + * + * @return the resourceTypes value + */ + public List resourceTypes() { + return this.resourceTypes; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersImpl.java new file mode 100644 index 0000000000000..48f99b588a7c9 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.Providers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_03_01.Provider; + +class ProvidersImpl extends WrapperImpl implements Providers { + private final ResourcesManager manager; + + ProvidersImpl(ResourcesManager manager) { + super(manager.inner().providers()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private ProviderImpl wrapModel(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + + @Override + public Observable unregisterAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.unregisterAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + }); + } + + @Override + public Observable registerAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.registerAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ProvidersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.getAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersInner.java new file mode 100644 index 0000000000000..20a9f2e9b2669 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ProvidersInner.java @@ -0,0 +1,727 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 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.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Providers. + */ +public class ProvidersInner { + /** The Retrofit service to perform REST calls. */ + private ProvidersService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of ProvidersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProvidersInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(ProvidersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Providers to be + * used by Retrofit to perform actually REST calls. + */ + interface ProvidersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Providers unregister" }) + @POST("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister") + Observable> unregister(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Providers register" }) + @POST("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register") + Observable> register(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Providers list" }) + @GET("subscriptions/{subscriptionId}/providers") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @Query("$expand") String expand, @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.resources.v2019_03_01.Providers get" }) + @GET("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}") + Observable> get(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @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.resources.v2019_03_01.Providers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 ProviderInner object if successful. + */ + public ProviderInner unregister(String resourceProviderNamespace) { + return unregisterWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 unregisterAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unregisterWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable unregisterAsync(String resourceProviderNamespace) { + return unregisterWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> unregisterWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.unregister(resourceProviderNamespace, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = unregisterDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse unregisterDelegate(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); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @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 ProviderInner object if successful. + */ + public ProviderInner register(String resourceProviderNamespace) { + return registerWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @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 registerAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(registerWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable registerAsync(String resourceProviderNamespace) { + return registerWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> registerWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.register(resourceProviderNamespace, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = registerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse registerDelegate(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); + } + + /** + * Gets all resource providers for a subscription. + * + * @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 PagedList<ProviderInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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."); + } + final Integer top = null; + final String expand = null; + return service.list(this.client.subscriptionId(), top, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @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 PagedList<ProviderInner> object if successful. + */ + public PagedList list(final Integer top, final String expand) { + ServiceResponse> response = listSinglePageAsync(top, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @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 Integer top, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(top, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listAsync(final Integer top, final String expand) { + return listWithServiceResponseAsync(top, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable>> listWithServiceResponseAsync(final Integer top, final String expand) { + return listSinglePageAsync(top, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + ServiceResponse> * @param top The number of results to return. If null is passed returns all deployments. + ServiceResponse> * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final Integer top, final String expand) { + 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(), top, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @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 ProviderInner object if successful. + */ + public ProviderInner get(String resourceProviderNamespace) { + return getWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the 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 getAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable getAsync(String resourceProviderNamespace) { + return getWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> getWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(resourceProviderNamespace, this.client.subscriptionId(), expand, 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); + } + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @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 ProviderInner object if successful. + */ + public ProviderInner get(String resourceProviderNamespace, String expand) { + return getWithServiceResponseAsync(resourceProviderNamespace, expand).toBlocking().single().body(); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @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 resourceProviderNamespace, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceProviderNamespace, expand), serviceCallback); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable getAsync(String resourceProviderNamespace, String expand) { + return getWithServiceResponseAsync(resourceProviderNamespace, expand).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> getWithServiceResponseAsync(String resourceProviderNamespace, String expand) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceProviderNamespace, this.client.subscriptionId(), expand, 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); + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<ProviderInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultImpl.java new file mode 100644 index 0000000000000..fd919b7502545 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultImpl.java @@ -0,0 +1,37 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroupExportResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceManagementErrorWithDetails; + +class ResourceGroupExportResultImpl extends WrapperImpl implements ResourceGroupExportResult { + private final ResourcesManager manager; + ResourceGroupExportResultImpl(ResourceGroupExportResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public ResourceManagementErrorWithDetails error() { + return this.inner().error(); + } + + @Override + public Object template() { + return this.inner().template(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultInner.java new file mode 100644 index 0000000000000..e8c8bd260dcf6 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupExportResultInner.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.ResourceManagementErrorWithDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group export result. + */ +public class ResourceGroupExportResultInner { + /** + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The error. + */ + @JsonProperty(value = "error") + private ResourceManagementErrorWithDetails error; + + /** + * Get the template content. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. + * + * @param template the template value to set + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the error. + * + * @return the error value + */ + public ResourceManagementErrorWithDetails error() { + return this.error; + } + + /** + * Set the error. + * + * @param error the error value to set + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withError(ResourceManagementErrorWithDetails error) { + this.error = error; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupImpl.java new file mode 100644 index 0000000000000..a97808da5d5b1 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupImpl.java @@ -0,0 +1,174 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroupPatchable; +import java.util.Map; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroupProperties; +import rx.functions.Func1; + +class ResourceGroupImpl extends CreatableUpdatableImpl implements ResourceGroup, ResourceGroup.Definition, ResourceGroup.Update { + private final ResourcesManager manager; + private String resourceGroupName; + private ResourceGroupPatchable updateParameter; + + ResourceGroupImpl(String name, ResourcesManager manager) { + super(name, new ResourceGroupInner()); + this.manager = manager; + // Set resource name + this.resourceGroupName = name; + // + this.updateParameter = new ResourceGroupPatchable(); + } + + ResourceGroupImpl(ResourceGroupInner inner, ResourcesManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.resourceGroupName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + // + this.updateParameter = new ResourceGroupPatchable(); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ResourceGroupsInner client = this.manager().inner().resourceGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.inner()) + .map(new Func1() { + @Override + public ResourceGroupInner call(ResourceGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ResourceGroupsInner client = this.manager().inner().resourceGroups(); + return client.updateAsync(this.resourceGroupName, this.updateParameter) + .map(new Func1() { + @Override + public ResourceGroupInner call(ResourceGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ResourceGroupsInner client = this.manager().inner().resourceGroups(); + return client.getAsync(this.resourceGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ResourceGroupPatchable(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ResourceGroupProperties properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ResourceGroupImpl withExistingSubscription() { + return this; + } + + @Override + public ResourceGroupImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ResourceGroupImpl withName(String name) { + this.updateParameter.withName(name); + return this; + } + + @Override + public ResourceGroupImpl withManagedBy(String managedBy) { + if (isInCreateMode()) { + this.inner().withManagedBy(managedBy); + } else { + this.updateParameter.withManagedBy(managedBy); + } + return this; + } + + @Override + public ResourceGroupImpl withProperties(ResourceGroupProperties properties) { + if (isInCreateMode()) { + this.inner().withProperties(properties); + } else { + this.updateParameter.withProperties(properties); + } + return this; + } + + @Override + public ResourceGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupInner.java new file mode 100644 index 0000000000000..e2a8637763e2f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroupProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * Resource group information. + */ +public class ResourceGroupInner extends Resource { + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private ResourceGroupProperties properties; + + /** + * The ID of the resource that manages this resource group. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * Get the properties value. + * + * @return the properties value + */ + public ResourceGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the ResourceGroupInner object itself. + */ + public ResourceGroupInner withProperties(ResourceGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the ID of the resource that manages this resource group. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the ID of the resource that manages this resource group. + * + * @param managedBy the managedBy value to set + * @return the ResourceGroupInner object itself. + */ + public ResourceGroupInner withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsImpl.java new file mode 100644 index 0000000000000..fb5ca20520870 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsImpl.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroupExportResult; +import com.microsoft.azure.management.resources.v2019_03_01.ExportTemplateRequest; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroup; + +class ResourceGroupsImpl extends WrapperImpl implements ResourceGroups { + private final ResourcesManager manager; + + ResourceGroupsImpl(ResourcesManager manager) { + super(manager.inner().resourceGroups()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public ResourceGroupImpl define(String name) { + return wrapModel(name); + } + + private ResourceGroupImpl wrapModel(ResourceGroupInner inner) { + return new ResourceGroupImpl(inner, manager()); + } + + private ResourceGroupImpl wrapModel(String name) { + return new ResourceGroupImpl(name, this.manager()); + } + + @Override + public Observable checkExistenceAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName) + ;} + + @Override + public Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { + ResourceGroupsInner client = this.inner(); + return client.exportTemplateAsync(resourceGroupName, parameters) + .map(new Func1() { + @Override + public ResourceGroupExportResult call(ResourceGroupExportResultInner inner) { + return new ResourceGroupExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ResourceGroupsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceGroup call(ResourceGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName) + .map(new Func1() { + @Override + public ResourceGroup call(ResourceGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName).toCompletable(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsInner.java new file mode 100644 index 0000000000000..85c8ad3859f0f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceGroupsInner.java @@ -0,0 +1,1010 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.resources.v2019_03_01.ExportTemplateRequest; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroupPatchable; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ResourceGroups. + */ +public class ResourceGroupsInner { + /** The Retrofit service to perform REST calls. */ + private ResourceGroupsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of ResourceGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ResourceGroupsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(ResourceGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ResourceGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ResourceGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups checkExistence" }) + @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourceGroupInner parameters, @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.resources.v2019_03_01.ResourceGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourceGroupPatchable parameters, @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.resources.v2019_03_01.ResourceGroups exportTemplate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate") + Observable> exportTemplate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ExportTemplateRequest parameters, @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.resources.v2019_03_01.ResourceGroups list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_03_01.ResourceGroups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @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 boolean object if successful. + */ + public boolean checkExistence(String resourceGroupName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @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 checkExistenceAsync(String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAsync(String resourceGroupName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.checkExistence(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @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 ResourceGroupInner object if successful. + */ + public ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @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, ResourceGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, ResourceGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupInner>() { + @Override + public ResourceGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, ResourceGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.createOrUpdate(resourceGroupName, this.client.subscriptionId(), parameters, 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()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @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 + */ + public void delete(String resourceGroupName) { + deleteWithServiceResponseAsync(resourceGroupName).toBlocking().last().body(); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @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 + */ + public void beginDelete(String resourceGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @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 beginDeleteAsync(String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @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 ResourceGroupInner object if successful. + */ + public ResourceGroupInner get(String resourceGroupName) { + return getWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable getAsync(String resourceGroupName) { + return getWithServiceResponseAsync(resourceGroupName).map(new Func1, ResourceGroupInner>() { + @Override + public ResourceGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, this.client.subscriptionId(), 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); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @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 ResourceGroupInner object if successful. + */ + public ResourceGroupInner update(String resourceGroupName, ResourceGroupPatchable parameters) { + return updateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @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 updateAsync(String resourceGroupName, ResourceGroupPatchable parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable updateAsync(String resourceGroupName, ResourceGroupPatchable parameters) { + return updateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupInner>() { + @Override + public ResourceGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, ResourceGroupPatchable parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.update(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @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 ResourceGroupExportResultInner object if successful. + */ + public ResourceGroupExportResultInner exportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @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 exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupExportResultInner object + */ + public Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupExportResultInner>() { + @Override + public ResourceGroupExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupExportResultInner object + */ + public Observable> exportTemplateWithServiceResponseAsync(String resourceGroupName, ExportTemplateRequest parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.exportTemplate(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateDelegate(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); + } + + /** + * Gets all the resource groups for a subscription. + * + * @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 PagedList<ResourceGroupInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the resource groups for a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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."); + } + final String filter = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 PagedList<ResourceGroupInner> object if successful. + */ + public PagedList list(final String filter, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable> listAsync(final String filter, final Integer top) { + return listWithServiceResponseAsync(filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top) { + return listSinglePageAsync(filter, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top) { + 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(), filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<ResourceGroupInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceManagementClientImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceManagementClientImpl.java new file mode 100644 index 0000000000000..87bd6e0a0be0f --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourceManagementClientImpl.java @@ -0,0 +1,280 @@ +/** + * 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.resources.v2019_03_01.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 ResourceManagementClientImpl class. + */ +public class ResourceManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ResourceManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for this operation. */ + private String apiVersion; + + /** + * Gets The API version to use for this operation. + * + * @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 ResourceManagementClientImpl 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 ResourceManagementClientImpl 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 ResourceManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * 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 DeploymentsInner object to access its operations. + */ + private DeploymentsInner deployments; + + /** + * Gets the DeploymentsInner object to access its operations. + * @return the DeploymentsInner object. + */ + public DeploymentsInner deployments() { + return this.deployments; + } + + /** + * The ProvidersInner object to access its operations. + */ + private ProvidersInner providers; + + /** + * Gets the ProvidersInner object to access its operations. + * @return the ProvidersInner object. + */ + public ProvidersInner providers() { + return this.providers; + } + + /** + * The ResourcesInner object to access its operations. + */ + private ResourcesInner resources; + + /** + * Gets the ResourcesInner object to access its operations. + * @return the ResourcesInner object. + */ + public ResourcesInner resources() { + return this.resources; + } + + /** + * The ResourceGroupsInner object to access its operations. + */ + private ResourceGroupsInner resourceGroups; + + /** + * Gets the ResourceGroupsInner object to access its operations. + * @return the ResourceGroupsInner object. + */ + public ResourceGroupsInner resourceGroups() { + return this.resourceGroups; + } + + /** + * The TagsInner object to access its operations. + */ + private TagsInner tags; + + /** + * Gets the TagsInner object to access its operations. + * @return the TagsInner object. + */ + public TagsInner tags() { + return this.tags; + } + + /** + * The DeploymentOperationsInner object to access its operations. + */ + private DeploymentOperationsInner deploymentOperations; + + /** + * Gets the DeploymentOperationsInner object to access its operations. + * @return the DeploymentOperationsInner object. + */ + public DeploymentOperationsInner deploymentOperations() { + return this.deploymentOperations; + } + + /** + * Initializes an instance of ResourceManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ResourceManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ResourceManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ResourceManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ResourceManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ResourceManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-05-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.deployments = new DeploymentsInner(restClient().retrofit(), this); + this.providers = new ProvidersInner(restClient().retrofit(), this); + this.resources = new ResourcesInner(restClient().retrofit(), this); + this.resourceGroups = new ResourceGroupsInner(restClient().retrofit(), this); + this.tags = new TagsInner(restClient().retrofit(), this); + this.deploymentOperations = new DeploymentOperationsInner(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(), "ResourceManagementClient", "2018-05-01"); + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesImpl.java new file mode 100644 index 0000000000000..a81a2c4fc7859 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesImpl.java @@ -0,0 +1,181 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.Resources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_03_01.GenericResource; +import com.microsoft.azure.management.resources.v2019_03_01.ResourcesMoveInfo; + +class ResourcesImpl extends WrapperImpl implements Resources { + private final ResourcesManager manager; + + ResourcesImpl(ResourcesManager manager) { + super(manager.inner().resources()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private GenericResourceImpl wrapModel(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + + @Override + public Observable listAsync() { + ResourcesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkExistenceByIdAsync(String resourceId, String apiVersion) { + ResourcesInner client = this.inner(); + return client.checkExistenceByIdAsync(resourceId, apiVersion) + ;} + + @Override + public Completable deleteByIdAsync(String resourceId, String apiVersion) { + ResourcesInner client = this.inner(); + return client.deleteByIdAsync(resourceId, apiVersion).toCompletable(); + } + + @Override + public Observable createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.createOrUpdateByIdAsync(resourceId, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.updateByIdAsync(resourceId, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String resourceId, String apiVersion) { + ResourcesInner client = this.inner(); + return client.getByIdAsync(resourceId, apiVersion) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + ResourcesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + ResourcesInner client = this.inner(); + return client.moveResourcesAsync(sourceResourceGroupName, parameters).toCompletable(); + } + + @Override + public Completable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + ResourcesInner client = this.inner(); + return client.validateMoveResourcesAsync(sourceResourceGroupName, parameters).toCompletable(); + } + + @Override + public Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + ResourcesInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion) + ;} + + @Override + public Completable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + ResourcesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.updateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + ResourcesInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesInner.java new file mode 100644 index 0000000000000..1dd24ace6853a --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesInner.java @@ -0,0 +1,2682 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.resources.v2019_03_01.ResourcesMoveInfo; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Resources. + */ +public class ResourcesInner implements InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ResourcesService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of ResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ResourcesInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(ResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Resources to be + * used by Retrofit to perform actually REST calls. + */ + interface ResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Resources listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @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.resources.v2019_03_01.Resources moveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") + Observable> moveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo parameters, @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.resources.v2019_03_01.Resources beginMoveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") + Observable> beginMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo parameters, @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.resources.v2019_03_01.Resources validateMoveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") + Observable> validateMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo parameters, @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.resources.v2019_03_01.Resources beginValidateMoveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") + Observable> beginValidateMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo parameters, @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.resources.v2019_03_01.Resources list" }) + @GET("subscriptions/{subscriptionId}/resources") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @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.resources.v2019_03_01.Resources checkExistence" }) + @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Resources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Resources beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Resources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Resources checkExistenceById" }) + @HEAD("{resourceId}") + Observable> checkExistenceById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_03_01.Resources deleteById" }) + @HTTP(path = "{resourceId}", method = "DELETE", hasBody = true) + Observable> deleteById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_03_01.Resources beginDeleteById" }) + @HTTP(path = "{resourceId}", method = "DELETE", hasBody = true) + Observable> beginDeleteById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_03_01.Resources createOrUpdateById" }) + @PUT("{resourceId}") + Observable> createOrUpdateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources beginCreateOrUpdateById" }) + @PUT("{resourceId}") + Observable> beginCreateOrUpdateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources updateById" }) + @PATCH("{resourceId}") + Observable> updateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources beginUpdateById" }) + @PATCH("{resourceId}") + Observable> beginUpdateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @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.resources.v2019_03_01.Resources getById" }) + @GET("{resourceId}") + Observable> getById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_03_01.Resources listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @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.resources.v2019_03_01.Resources listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @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 PagedList<GenericResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final String expand = null; + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @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 PagedList<GenericResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final String expand, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @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> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, expand, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + ServiceResponse> * @param resourceGroupName The resource group with the resources to get. + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + ServiceResponse> * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @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 + */ + public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @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 moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> moveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + Observable> observable = service.moveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @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 + */ + public void beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @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 beginMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.beginMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginMoveResourcesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginMoveResourcesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @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 + */ + public void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @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 validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> validateMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + Observable> observable = service.validateMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @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 + */ + public void beginValidateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @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 beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginValidateMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + return service.beginValidateMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginValidateMoveResourcesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginValidateMoveResourcesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(409, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the resources in a subscription. + * + * @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 PagedList<GenericResourceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources in a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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."); + } + final String filter = null; + final String expand = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 PagedList<GenericResourceInner> object if successful. + */ + public PagedList list(final String filter, final String expand, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, expand, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, expand, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listAsync(final String filter, final String expand, final Integer top) { + return listWithServiceResponseAsync(filter, expand, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final String expand, final Integer top) { + return listSinglePageAsync(filter, expand, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources in a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + ServiceResponse> * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final String expand, final Integer top) { + 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(), filter, expand, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @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 boolean object if successful. + */ + public boolean checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @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 checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.checkExistence(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @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 + */ + public void delete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().last().body(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @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 resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @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 + */ + public void beginDelete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + beginDeleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @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 beginDeleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @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 resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner update(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @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 updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner beginUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @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 beginUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner get(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @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 resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.get(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), 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); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 boolean object if successful. + */ + public boolean checkExistenceById(String resourceId, String apiVersion) { + return checkExistenceByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 checkExistenceByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceByIdAsync(String resourceId, String apiVersion) { + return checkExistenceByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.checkExistenceById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 + */ + public void deleteById(String resourceId, String apiVersion) { + deleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().last().body(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 deleteByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteByIdAsync(String resourceId, String apiVersion) { + return deleteByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + Observable> observable = service.deleteById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 + */ + public void beginDeleteById(String resourceId, String apiVersion) { + beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 beginDeleteByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteByIdAsync(String resourceId, String apiVersion) { + return beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.beginDeleteById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @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 createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner beginCreateOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @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 beginCreateOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginCreateOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginCreateOrUpdateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner updateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @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 updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.updateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner beginUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @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 beginUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginUpdateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 GenericResourceInner object if successful. + */ + public GenericResourceInner getById(String resourceId, String apiVersion) { + return getByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @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 getByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable getByIdAsync(String resourceId, String apiVersion) { + return getByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> getByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.getById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(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); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<GenericResourceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(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 all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<GenericResourceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the resources in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesManager.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesManager.java new file mode 100644 index 0000000000000..5ec9ce096b02b --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/ResourcesManager.java @@ -0,0 +1,171 @@ +/** + * 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.resources.v2019_03_01.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.resources.v2019_03_01.Operations; +import com.microsoft.azure.management.resources.v2019_03_01.Deployments; +import com.microsoft.azure.management.resources.v2019_03_01.Providers; +import com.microsoft.azure.management.resources.v2019_03_01.Resources; +import com.microsoft.azure.management.resources.v2019_03_01.ResourceGroups; +import com.microsoft.azure.management.resources.v2019_03_01.Tags; +import com.microsoft.azure.management.resources.v2019_03_01.DeploymentOperations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Resources resource management. + */ +public final class ResourcesManager extends ManagerCore { + private Operations operations; + private Deployments deployments; + private Providers providers; + private Resources resources; + private ResourceGroups resourceGroups; + private Tags tags; + private DeploymentOperations deploymentOperations; + /** + * Get a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ResourcesManager.ConfigurableImpl(); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ResourcesManager(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 ResourcesManager that exposes Resources resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(RestClient restClient, String subscriptionId) { + return new ResourcesManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ResourcesManager that exposes Resources management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Resources management API entry points that work across subscriptions + */ + ResourcesManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @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 Deployments. + */ + public Deployments deployments() { + if (this.deployments == null) { + this.deployments = new DeploymentsImpl(this); + } + return this.deployments; + } + + /** + * @return Entry point to manage Providers. + */ + public Providers providers() { + if (this.providers == null) { + this.providers = new ProvidersImpl(this); + } + return this.providers; + } + + /** + * @return Entry point to manage Resources. + */ + public Resources resources() { + if (this.resources == null) { + this.resources = new ResourcesImpl(this); + } + return this.resources; + } + + /** + * @return Entry point to manage ResourceGroups. + */ + public ResourceGroups resourceGroups() { + if (this.resourceGroups == null) { + this.resourceGroups = new ResourceGroupsImpl(this); + } + return this.resourceGroups; + } + + /** + * @return Entry point to manage Tags. + */ + public Tags tags() { + if (this.tags == null) { + this.tags = new TagsImpl(this); + } + return this.tags; + } + + /** + * @return Entry point to manage DeploymentOperations. + */ + public DeploymentOperations deploymentOperations() { + if (this.deploymentOperations == null) { + this.deploymentOperations = new DeploymentOperationsImpl(this); + } + return this.deploymentOperations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ResourcesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ResourcesManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ResourcesManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ResourceManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsImpl.java new file mode 100644 index 0000000000000..04658f3eee88a --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsImpl.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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.TagDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_03_01.TagCount; +import java.util.ArrayList; +import com.microsoft.azure.management.resources.v2019_03_01.TagValue; +import java.util.List; + +class TagDetailsImpl extends WrapperImpl implements TagDetails { + private final ResourcesManager manager; + + TagDetailsImpl(TagDetailsInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public TagCount count() { + return this.inner().count(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tagName() { + return this.inner().tagName(); + } + + @Override + public List values() { + List lst = new ArrayList(); + if (this.inner().values() != null) { + for (TagValueInner inner : this.inner().values()) { + lst.add( new TagValueImpl(inner, manager())); + } + } + return lst; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsInner.java new file mode 100644 index 0000000000000..3df37617a6898 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagDetailsInner.java @@ -0,0 +1,113 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.TagCount; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tag details. + */ +public class TagDetailsInner { + /** + * The tag ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tag name. + */ + @JsonProperty(value = "tagName") + private String tagName; + + /** + * The total number of resources that use the resource tag. When a tag is + * initially created and has no associated resources, the value is 0. + */ + @JsonProperty(value = "count") + private TagCount count; + + /** + * The list of tag values. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the tag ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tag name. + * + * @return the tagName value + */ + public String tagName() { + return this.tagName; + } + + /** + * Set the tag name. + * + * @param tagName the tagName value to set + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Get the total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + * + * @return the count value + */ + public TagCount count() { + return this.count; + } + + /** + * Set the total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + * + * @param count the count value to set + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withCount(TagCount count) { + this.count = count; + return this; + } + + /** + * Get the list of tag values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the list of tag values. + * + * @param values the values value to set + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueImpl.java new file mode 100644 index 0000000000000..759400242b05e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueImpl.java @@ -0,0 +1,42 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.TagValue; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.TagCount; + +class TagValueImpl extends WrapperImpl implements TagValue { + private final ResourcesManager manager; + TagValueImpl(TagValueInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public TagCount count() { + return this.inner().count(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tagValue() { + return this.inner().tagValue(); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueInner.java new file mode 100644 index 0000000000000..d1864dadd6601 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagValueInner.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.management.resources.v2019_03_01.TagCount; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tag information. + */ +public class TagValueInner { + /** + * The tag ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tag value. + */ + @JsonProperty(value = "tagValue") + private String tagValue; + + /** + * The tag value count. + */ + @JsonProperty(value = "count") + private TagCount count; + + /** + * Get the tag ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tag value. + * + * @return the tagValue value + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tag value. + * + * @param tagValue the tagValue value to set + * @return the TagValueInner object itself. + */ + public TagValueInner withTagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Get the tag value count. + * + * @return the count value + */ + public TagCount count() { + return this.count; + } + + /** + * Set the tag value count. + * + * @param count the count value to set + * @return the TagValueInner object itself. + */ + public TagValueInner withCount(TagCount count) { + this.count = count; + return this; + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsImpl.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsImpl.java new file mode 100644 index 0000000000000..a917cea0877f0 --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2019_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_03_01.Tags; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_03_01.TagDetails; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_03_01.TagValue; + +class TagsImpl extends WrapperImpl implements Tags { + private final ResourcesManager manager; + + TagsImpl(ResourcesManager manager) { + super(manager.inner().tags()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private TagDetailsImpl wrapTagDetailsModel(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync() { + TagsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagDetails call(TagDetailsInner inner) { + return wrapTagDetailsModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String tagName) { + TagsInner client = this.inner(); + return client.deleteAsync(tagName).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String tagName) { + TagsInner client = this.inner(); + return client.createOrUpdateAsync(tagName) + .map(new Func1() { + @Override + public TagDetails call(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteValueAsync(String tagName, String tagValue) { + TagsInner client = this.inner(); + return client.deleteValueAsync(tagName, tagValue).toCompletable(); + } + + @Override + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + TagsInner client = this.inner(); + return client.createOrUpdateValueAsync(tagName, tagValue) + .map(new Func1() { + @Override + public TagValue call(TagValueInner inner) { + return new TagValueImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsInner.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsInner.java new file mode 100644 index 0000000000000..c9c36af28deff --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/TagsInner.java @@ -0,0 +1,646 @@ +/** + * 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.resources.v2019_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tags. + */ +public class TagsInner { + /** The Retrofit service to perform REST calls. */ + private TagsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of TagsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(TagsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tags to be + * used by Retrofit to perform actually REST calls. + */ + interface TagsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Tags deleteValue" }) + @HTTP(path = "subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", method = "DELETE", hasBody = true) + Observable> deleteValue(@Path("tagName") String tagName, @Path("tagValue") String tagValue, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Tags createOrUpdateValue" }) + @PUT("subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + Observable> createOrUpdateValue(@Path("tagName") String tagName, @Path("tagValue") String tagValue, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Tags createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/tagNames/{tagName}") + Observable> createOrUpdate(@Path("tagName") String tagName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Tags delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/tagNames/{tagName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("tagName") String tagName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Tags list" }) + @GET("subscriptions/{subscriptionId}/tagNames") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_03_01.Tags listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 + */ + public void deleteValue(String tagName, String tagValue) { + deleteValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 deleteValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteValueWithServiceResponseAsync(tagName, tagValue), serviceCallback); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteValueAsync(String tagName, String tagValue) { + return deleteValueWithServiceResponseAsync(tagName, tagValue).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteValueWithServiceResponseAsync(String tagName, String tagValue) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (tagValue == null) { + throw new IllegalArgumentException("Parameter tagValue is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteValue(tagName, tagValue, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteValueDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteValueDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 TagValueInner object if successful. + */ + public TagValueInner createOrUpdateValue(String tagName, String tagValue) { + return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 createOrUpdateValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateValueWithServiceResponseAsync(tagName, tagValue), serviceCallback); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagValueInner object + */ + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1, TagValueInner>() { + @Override + public TagValueInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagValueInner object + */ + public Observable> createOrUpdateValueWithServiceResponseAsync(String tagName, String tagValue) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (tagValue == null) { + throw new IllegalArgumentException("Parameter tagValue is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.createOrUpdateValue(tagName, tagValue, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateValueDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateValueDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @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 TagDetailsInner object if successful. + */ + public TagDetailsInner createOrUpdate(String tagName) { + return createOrUpdateWithServiceResponseAsync(tagName).toBlocking().single().body(); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @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 tagName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(tagName), serviceCallback); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDetailsInner object + */ + public Observable createOrUpdateAsync(String tagName) { + return createOrUpdateWithServiceResponseAsync(tagName).map(new Func1, TagDetailsInner>() { + @Override + public TagDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDetailsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String tagName) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.createOrUpdate(tagName, this.client.subscriptionId(), 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()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @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 + */ + public void delete(String tagName) { + deleteWithServiceResponseAsync(tagName).toBlocking().single().body(); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @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 tagName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(tagName), serviceCallback); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String tagName) { + return deleteWithServiceResponseAsync(tagName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String tagName) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(tagName, this.client.subscriptionId(), 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @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 PagedList<TagDetailsInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } 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); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<TagDetailsInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(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/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/package-info.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/implementation/package-info.java new file mode 100644 index 0000000000000..d689037786d2e --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/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 ResourceManagementClient. + * Provides operations for working with resources and resource groups. + */ +package com.microsoft.azure.management.resources.v2019_03_01.implementation; diff --git a/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/package-info.java b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/package-info.java new file mode 100644 index 0000000000000..bc44fb7843ddf --- /dev/null +++ b/resources/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/resources/v2019_03_01/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 ResourceManagementClient. + * Provides operations for working with resources and resource groups. + */ +package com.microsoft.azure.management.resources.v2019_03_01;