diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2ef96dcd10582..195905a200c6a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -326,6 +326,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-solutions;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index 928014fa07f54..73fb654b6ce14 100644 --- a/pom.xml +++ b/pom.xml @@ -824,6 +824,7 @@ sdk/servicebus sdk/servicefabric sdk/signalr + sdk/solutions sdk/spring sdk/sqlvirtualmachine sdk/storage diff --git a/sdk/solutions/azure-resourcemanager-solutions/CHANGELOG.md b/sdk/solutions/azure-resourcemanager-solutions/CHANGELOG.md new file mode 100644 index 0000000000000..60b86cf74d7d9 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-14) + +- Azure Resource Manager ManagedApplication client library for Java. This package contains Microsoft Azure SDK for ManagedApplication Management SDK. Managed Application Client. Package tag package-managedapplications-2021-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/solutions/azure-resourcemanager-solutions/README.md b/sdk/solutions/azure-resourcemanager-solutions/README.md new file mode 100644 index 0000000000000..dbb8e37cbcf91 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ManagedApplication client library for Java + +Azure Resource Manager ManagedApplication client library for Java. + +This package contains Microsoft Azure SDK for ManagedApplication Management SDK. Managed Application Client. Package tag package-managedapplications-2021-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-solutions;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-solutions + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ManagedApplicationManager manager = ManagedApplicationManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/solutions/azure-resourcemanager-solutions/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/solutions/azure-resourcemanager-solutions/SAMPLE.md b/sdk/solutions/azure-resourcemanager-solutions/SAMPLE.md new file mode 100644 index 0000000000000..69f37809aa33f --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/SAMPLE.md @@ -0,0 +1,580 @@ +# Code snippets and samples + + +## ApplicationDefinitions + +- [CreateOrUpdate](#applicationdefinitions_createorupdate) +- [Delete](#applicationdefinitions_delete) +- [GetByResourceGroup](#applicationdefinitions_getbyresourcegroup) +- [List](#applicationdefinitions_list) +- [ListByResourceGroup](#applicationdefinitions_listbyresourcegroup) +- [Update](#applicationdefinitions_update) + +## Applications + +- [CreateOrUpdate](#applications_createorupdate) +- [Delete](#applications_delete) +- [GetByResourceGroup](#applications_getbyresourcegroup) +- [List](#applications_list) +- [ListAllowedUpgradePlans](#applications_listallowedupgradeplans) +- [ListByResourceGroup](#applications_listbyresourcegroup) +- [RefreshPermissions](#applications_refreshpermissions) +- [Update](#applications_update) + +## JitRequests + +- [CreateOrUpdate](#jitrequests_createorupdate) +- [Delete](#jitrequests_delete) +- [GetByResourceGroup](#jitrequests_getbyresourcegroup) +- [ListByResourceGroup](#jitrequests_listbyresourcegroup) +- [ListBySubscription](#jitrequests_listbysubscription) +- [Update](#jitrequests_update) + +## ResourceProvider + +- [ListOperations](#resourceprovider_listoperations) +### ApplicationDefinitions_CreateOrUpdate + +```java +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationLockLevel; +import java.util.Arrays; + +/** Samples for ApplicationDefinitions CreateOrUpdate. */ +public final class ApplicationDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json + */ + /** + * Sample code: Create or update managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager + .applicationDefinitions() + .define("myManagedApplicationDef") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withLockLevel(ApplicationLockLevel.NONE) + .withDisplayName("myManagedApplicationDef") + .withAuthorizations( + Arrays + .asList( + new ApplicationAuthorization() + .withPrincipalId("validprincipalguid") + .withRoleDefinitionId("validroleguid"))) + .withDescription("myManagedApplicationDef description") + .withPackageFileUri("https://path/to/packagezipfile") + .create(); + } +} +``` + +### ApplicationDefinitions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions Delete. */ +public final class ApplicationDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json + */ + /** + * Sample code: delete managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void deleteManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().delete("rg", "myManagedApplicationDef", Context.NONE); + } +} +``` + +### ApplicationDefinitions_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions GetByResourceGroup. */ +public final class ApplicationDefinitionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json + */ + /** + * Sample code: Get managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void getManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().getByResourceGroupWithResponse("rg", "myManagedApplicationDef", Context.NONE); + } +} +``` + +### ApplicationDefinitions_List + +```java +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions List. */ +public final class ApplicationDefinitionsListSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json + */ + /** + * Sample code: List managed application definitions. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listManagedApplicationDefinitions( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().list(Context.NONE); + } +} +``` + +### ApplicationDefinitions_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions ListByResourceGroup. */ +public final class ApplicationDefinitionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json + */ + /** + * Sample code: List managed application definitions. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listManagedApplicationDefinitions( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().listByResourceGroup("rg", Context.NONE); + } +} +``` + +### ApplicationDefinitions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.models.ApplicationDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationDefinitions Update. */ +public final class ApplicationDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json + */ + /** + * Sample code: Update managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void updateManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + ApplicationDefinition resource = + manager + .applicationDefinitions() + .getByResourceGroupWithResponse("rg", "myManagedApplicationDef", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Applications_CreateOrUpdate + +```java +/** Samples for Applications CreateOrUpdate. */ +public final class ApplicationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplication.json + */ + /** + * Sample code: Create or update managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateManagedApplication( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager + .applications() + .define("myManagedApplication") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withKind("ServiceCatalog") + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") + .create(); + } +} +``` + +### Applications_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Applications Delete. */ +public final class ApplicationsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplication.json + */ + /** + * Sample code: Delete managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void deleteManagedApplication(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().delete("rg", "myManagedApplication", Context.NONE); + } +} +``` + +### Applications_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Applications GetByResourceGroup. */ +public final class ApplicationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplication.json + */ + /** + * Sample code: Get a managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void getAManagedApplication(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().getByResourceGroupWithResponse("rg", "myManagedApplication", Context.NONE); + } +} +``` + +### Applications_List + +```java +import com.azure.core.util.Context; + +/** Samples for Applications List. */ +public final class ApplicationsListSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json + */ + /** + * Sample code: Lists applications. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listsApplications(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().list(Context.NONE); + } +} +``` + +### Applications_ListAllowedUpgradePlans + +```java +import com.azure.core.util.Context; + +/** Samples for Applications ListAllowedUpgradePlans. */ +public final class ApplicationsListAllowedUpgradePlansSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listAllowedUpgradePlans.json + */ + /** + * Sample code: List allowed upgrade plans for application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listAllowedUpgradePlansForApplication( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().listAllowedUpgradePlansWithResponse("rg", "myManagedApplication", Context.NONE); + } +} +``` + +### Applications_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Applications ListByResourceGroup. */ +public final class ApplicationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json + */ + /** + * Sample code: Lists applications. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listsApplications(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().listByResourceGroup("rg", Context.NONE); + } +} +``` + +### Applications_RefreshPermissions + +```java +import com.azure.core.util.Context; + +/** Samples for Applications RefreshPermissions. */ +public final class ApplicationsRefreshPermissionsSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/refreshApplicationPermissions.json + */ + /** + * Sample code: Refresh managed application permissions. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void refreshManagedApplicationPermissions( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().refreshPermissions("rg", "myManagedApplication", Context.NONE); + } +} +``` + +### Applications_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.models.Application; + +/** Samples for Applications Update. */ +public final class ApplicationsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplication.json + */ + /** + * Sample code: Create or update managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateManagedApplication( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + Application resource = + manager + .applications() + .getByResourceGroupWithResponse("rg", "myManagedApplication", Context.NONE) + .getValue(); + resource + .update() + .withKind("ServiceCatalog") + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") + .apply(); + } +} +``` + +### JitRequests_CreateOrUpdate + +```java +import com.azure.resourcemanager.solutions.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.solutions.models.JitSchedulingPolicy; +import com.azure.resourcemanager.solutions.models.JitSchedulingType; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for JitRequests CreateOrUpdate. */ +public final class JitRequestsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager + .jitRequests() + .define("myJitRequest") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withApplicationResourceId( + "/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158") + .withJitAuthorizationPolicies( + Arrays + .asList( + new JitAuthorizationPolicies() + .withPrincipalId("1db8e132e2934dbcb8e1178a61319491") + .withRoleDefinitionId("ecd05a23-931a-4c38-a52b-ac7c4c583334"))) + .withJitSchedulingPolicy( + new JitSchedulingPolicy() + .withType(JitSchedulingType.ONCE) + .withDuration(Duration.parse("PT8H")) + .withStartTime(OffsetDateTime.parse("2021-04-22T05:48:30.6661804Z"))) + .create(); + } +} +``` + +### JitRequests_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JitRequests Delete. */ +public final class JitRequestsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteJitRequest.json + */ + /** + * Sample code: Delete jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void deleteJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().deleteWithResponse("rg", "myJitRequest", Context.NONE); + } +} +``` + +### JitRequests_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for JitRequests GetByResourceGroup. */ +public final class JitRequestsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().getByResourceGroupWithResponse("rg", "myJitRequest", Context.NONE); + } +} +``` + +### JitRequests_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for JitRequests ListByResourceGroup. */ +public final class JitRequestsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: List jit requests. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listJitRequests(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().listByResourceGroupWithResponse("rg", Context.NONE); + } +} +``` + +### JitRequests_ListBySubscription + +```java +import com.azure.core.util.Context; + +/** Samples for JitRequests ListBySubscription. */ +public final class JitRequestsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: List jit requests. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listJitRequests(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().listBySubscriptionWithResponse(Context.NONE); + } +} +``` + +### JitRequests_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.models.JitRequestDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JitRequests Update. */ +public final class JitRequestsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + JitRequestDefinition resource = + manager.jitRequests().getByResourceGroupWithResponse("rg", "myJitRequest", Context.NONE).getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ResourceProvider_ListOperations + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider ListOperations. */ +public final class ResourceProviderListOperationsSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listSolutionsOperations.json + */ + /** + * Sample code: List Solutions operations. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listSolutionsOperations(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.resourceProviders().listOperations(Context.NONE); + } +} +``` + diff --git a/sdk/solutions/azure-resourcemanager-solutions/pom.xml b/sdk/solutions/azure-resourcemanager-solutions/pom.xml new file mode 100644 index 0000000000000..6fc700bb9a683 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-solutions + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ManagedApplication Management + This package contains Microsoft Azure SDK for ManagedApplication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Managed Application Client. Package tag package-managedapplications-2021-07. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/ManagedApplicationManager.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/ManagedApplicationManager.java new file mode 100644 index 0000000000000..416b751994795 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/ManagedApplicationManager.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.ManagedApplicationManagementClient; +import com.azure.resourcemanager.solutions.implementation.ApplicationDefinitionsImpl; +import com.azure.resourcemanager.solutions.implementation.ApplicationsImpl; +import com.azure.resourcemanager.solutions.implementation.JitRequestsImpl; +import com.azure.resourcemanager.solutions.implementation.ManagedApplicationManagementClientBuilder; +import com.azure.resourcemanager.solutions.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitions; +import com.azure.resourcemanager.solutions.models.Applications; +import com.azure.resourcemanager.solutions.models.JitRequests; +import com.azure.resourcemanager.solutions.models.ResourceProviders; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to ManagedApplicationManager. Managed Application Client. */ +public final class ManagedApplicationManager { + private ResourceProviders resourceProviders; + + private Applications applications; + + private ApplicationDefinitions applicationDefinitions; + + private JitRequests jitRequests; + + private final ManagedApplicationManagementClient clientObject; + + private ManagedApplicationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ManagedApplicationManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ManagedApplication service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedApplication service API instance. + */ + public static ManagedApplicationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ManagedApplicationManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ManagedApplicationManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ManagedApplication service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedApplication service API instance. + */ + public ManagedApplicationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.solutions") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ManagedApplicationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of Applications. */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** @return Resource collection API of ApplicationDefinitions. */ + public ApplicationDefinitions applicationDefinitions() { + if (this.applicationDefinitions == null) { + this.applicationDefinitions = + new ApplicationDefinitionsImpl(clientObject.getApplicationDefinitions(), this); + } + return applicationDefinitions; + } + + /** @return Resource collection API of JitRequests. */ + public JitRequests jitRequests() { + if (this.jitRequests == null) { + this.jitRequests = new JitRequestsImpl(clientObject.getJitRequests(), this); + } + return jitRequests; + } + + /** + * @return Wrapped service client ManagedApplicationManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ManagedApplicationManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ApplicationDefinitionsClient.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ApplicationDefinitionsClient.java new file mode 100644 index 0000000000000..c9d9d7d1589c6 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ApplicationDefinitionsClient.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionPatchable; + +/** An instance of this class provides access to all the operations defined in ApplicationDefinitionsClient. */ +public interface ApplicationDefinitionsClient { + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationDefinitionInner getByResourceGroup(String resourceGroupName, String applicationDefinitionName); + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context); + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String applicationDefinitionName); + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String applicationDefinitionName, Context context); + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String applicationDefinitionName); + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String applicationDefinitionName, Context context); + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context); + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationDefinitionInner createOrUpdate( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationDefinitionInner createOrUpdate( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context); + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationDefinitionInner update( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters); + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionPatchable parameters, + Context context); + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the application definitions within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all the application definitions within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ApplicationsClient.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ApplicationsClient.java new file mode 100644 index 0000000000000..be8189a960eb9 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ApplicationsClient.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationInner; +import com.azure.resourcemanager.solutions.models.ApplicationPatchable; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public interface ApplicationsClient { + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner getByResourceGroup(String resourceGroupName, String applicationName); + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationName, Context context); + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String applicationName); + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String applicationName, Context context); + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String applicationName); + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String applicationName, Context context); + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationInner> beginCreateOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters); + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationInner> beginCreateOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context); + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner createOrUpdate(String resourceGroupName, String applicationName, ApplicationInner parameters); + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner createOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context); + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner update(String resourceGroupName, String applicationName); + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String applicationName, ApplicationPatchable parameters, Context context); + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the applications within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all the applications within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshPermissions(String resourceGroupName, String applicationName); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshPermissions( + String resourceGroupName, String applicationName, Context context); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshPermissions(String resourceGroupName, String applicationName); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshPermissions(String resourceGroupName, String applicationName, Context context); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void listAllowedUpgradePlans(String resourceGroupName, String applicationName); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/JitRequestsClient.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/JitRequestsClient.java new file mode 100644 index 0000000000000..0aa456bcc0dbb --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/JitRequestsClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.solutions.models.JitRequestPatchable; + +/** An instance of this class provides access to all the operations defined in JitRequestsClient. */ +public interface JitRequestsClient { + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner getByResourceGroup(String resourceGroupName, String jitRequestName); + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context); + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner update(String resourceGroupName, String jitRequestName, JitRequestPatchable parameters); + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters, Context context); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String jitRequestName); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String jitRequestName, Context context); + + /** + * Retrieves all JIT requests within the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionListResultInner listBySubscription(); + + /** + * Retrieves all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listBySubscriptionWithResponse(Context context); + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionListResultInner listByResourceGroup(String resourceGroupName); + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByResourceGroupWithResponse( + String resourceGroupName, Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ManagedApplicationManagementClient.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ManagedApplicationManagementClient.java new file mode 100644 index 0000000000000..41ab4b372c43c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ManagedApplicationManagementClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ManagedApplicationManagementClient class. */ +public interface ManagedApplicationManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the ApplicationDefinitionsClient object to access its operations. + * + * @return the ApplicationDefinitionsClient object. + */ + ApplicationDefinitionsClient getApplicationDefinitions(); + + /** + * Gets the JitRequestsClient object to access its operations. + * + * @return the JitRequestsClient object. + */ + JitRequestsClient getJitRequests(); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ResourceProvidersClient.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..60c9b8634fffc --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/ResourceProvidersClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(); + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationDefinitionInner.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationDefinitionInner.java new file mode 100644 index 0000000000000..59cb6d112ed3c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationDefinitionInner.java @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.solutions.models.ApplicationDeploymentPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationLockLevel; +import com.azure.resourcemanager.solutions.models.ApplicationManagementPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationNotificationPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationPackageLockingPolicyDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationPolicy; +import com.azure.resourcemanager.solutions.models.GenericResource; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.azure.resourcemanager.solutions.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Information about managed application definition. */ +@Fluent +public final class ApplicationDefinitionInner extends GenericResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDefinitionInner.class); + + /* + * The managed application definition properties. + */ + @JsonProperty(value = "properties", required = true) + private ApplicationDefinitionProperties innerProperties = new ApplicationDefinitionProperties(); + + /** + * Get the innerProperties property: The managed application definition properties. + * + * @return the innerProperties value. + */ + private ApplicationDefinitionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ApplicationDefinitionInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationDefinitionInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationDefinitionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationDefinitionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the lockLevel property: The managed application lock level. + * + * @return the lockLevel value. + */ + public ApplicationLockLevel lockLevel() { + return this.innerProperties() == null ? null : this.innerProperties().lockLevel(); + } + + /** + * Set the lockLevel property: The managed application lock level. + * + * @param lockLevel the lockLevel value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withLockLevel(ApplicationLockLevel lockLevel) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withLockLevel(lockLevel); + return this; + } + + /** + * Get the displayName property: The managed application definition display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The managed application definition display name. + * + * @param displayName the displayName value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the isEnabled property: A value indicating whether the package is enabled or not. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: A value indicating whether the package is enabled or not. + * + * @param isEnabled the isEnabled value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the authorizations property: The managed application provider authorizations. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.innerProperties() == null ? null : this.innerProperties().authorizations(); + } + + /** + * Set the authorizations property: The managed application provider authorizations. + * + * @param authorizations the authorizations value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withAuthorizations(List authorizations) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withAuthorizations(authorizations); + return this; + } + + /** + * Get the artifacts property: The collection of managed application artifacts. The portal will use the files + * specified as artifacts to construct the user experience of creating a managed application from a managed + * application definition. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.innerProperties() == null ? null : this.innerProperties().artifacts(); + } + + /** + * Set the artifacts property: The collection of managed application artifacts. The portal will use the files + * specified as artifacts to construct the user experience of creating a managed application from a managed + * application definition. + * + * @param artifacts the artifacts value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withArtifacts(List artifacts) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withArtifacts(artifacts); + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the description property: The managed application definition description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The managed application definition description. + * + * @param description the description value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the packageFileUri property: The managed application definition package file Uri. Use this element. + * + * @return the packageFileUri value. + */ + public String packageFileUri() { + return this.innerProperties() == null ? null : this.innerProperties().packageFileUri(); + } + + /** + * Set the packageFileUri property: The managed application definition package file Uri. Use this element. + * + * @param packageFileUri the packageFileUri value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withPackageFileUri(String packageFileUri) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withPackageFileUri(packageFileUri); + return this; + } + + /** + * Get the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountId(); + } + + /** + * Set the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @param storageAccountId the storageAccountId value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withStorageAccountId(String storageAccountId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withStorageAccountId(storageAccountId); + return this; + } + + /** + * Get the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a + * JObject or well-formed JSON string. + * + * @return the mainTemplate value. + */ + public Object mainTemplate() { + return this.innerProperties() == null ? null : this.innerProperties().mainTemplate(); + } + + /** + * Set the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a + * JObject or well-formed JSON string. + * + * @param mainTemplate the mainTemplate value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withMainTemplate(Object mainTemplate) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withMainTemplate(mainTemplate); + return this; + } + + /** + * Get the createUiDefinition property: The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + * + * @return the createUiDefinition value. + */ + public Object createUiDefinition() { + return this.innerProperties() == null ? null : this.innerProperties().createUiDefinition(); + } + + /** + * Set the createUiDefinition property: The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + * + * @param createUiDefinition the createUiDefinition value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withCreateUiDefinition(Object createUiDefinition) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withCreateUiDefinition(createUiDefinition); + return this; + } + + /** + * Get the notificationPolicy property: The managed application notification policy. + * + * @return the notificationPolicy value. + */ + public ApplicationNotificationPolicy notificationPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().notificationPolicy(); + } + + /** + * Set the notificationPolicy property: The managed application notification policy. + * + * @param notificationPolicy the notificationPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withNotificationPolicy(notificationPolicy); + return this; + } + + /** + * Get the lockingPolicy property: The managed application locking policy. + * + * @return the lockingPolicy value. + */ + public ApplicationPackageLockingPolicyDefinition lockingPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().lockingPolicy(); + } + + /** + * Set the lockingPolicy property: The managed application locking policy. + * + * @param lockingPolicy the lockingPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withLockingPolicy(lockingPolicy); + return this; + } + + /** + * Get the deploymentPolicy property: The managed application deployment policy. + * + * @return the deploymentPolicy value. + */ + public ApplicationDeploymentPolicy deploymentPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().deploymentPolicy(); + } + + /** + * Set the deploymentPolicy property: The managed application deployment policy. + * + * @param deploymentPolicy the deploymentPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withDeploymentPolicy(deploymentPolicy); + return this; + } + + /** + * Get the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @return the managementPolicy value. + */ + public ApplicationManagementPolicy managementPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().managementPolicy(); + } + + /** + * Set the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @param managementPolicy the managementPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withManagementPolicy(ApplicationManagementPolicy managementPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withManagementPolicy(managementPolicy); + return this; + } + + /** + * Get the policies property: The managed application provider policies. + * + * @return the policies value. + */ + public List policies() { + return this.innerProperties() == null ? null : this.innerProperties().policies(); + } + + /** + * Set the policies property: The managed application provider policies. + * + * @param policies the policies value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withPolicies(List policies) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withPolicies(policies); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ApplicationDefinitionInner")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationDefinitionProperties.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationDefinitionProperties.java new file mode 100644 index 0000000000000..49537361de830 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationDefinitionProperties.java @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.solutions.models.ApplicationDeploymentPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationLockLevel; +import com.azure.resourcemanager.solutions.models.ApplicationManagementPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationNotificationPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationPackageLockingPolicyDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationPolicy; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed application definition properties. */ +@Fluent +public final class ApplicationDefinitionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDefinitionProperties.class); + + /* + * The managed application lock level. + */ + @JsonProperty(value = "lockLevel", required = true) + private ApplicationLockLevel lockLevel; + + /* + * The managed application definition display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * A value indicating whether the package is enabled or not. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * The managed application provider authorizations. + */ + @JsonProperty(value = "authorizations") + private List authorizations; + + /* + * The collection of managed application artifacts. The portal will use the + * files specified as artifacts to construct the user experience of + * creating a managed application from a managed application definition. + */ + @JsonProperty(value = "artifacts") + private List artifacts; + + /* + * Provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The managed application definition description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The managed application definition package file Uri. Use this element + */ + @JsonProperty(value = "packageFileUri") + private String packageFileUri; + + /* + * The storage account id for bring your own storage scenario. + */ + @JsonProperty(value = "storageAccountId") + private String storageAccountId; + + /* + * The inline main template json which has resources to be provisioned. It + * can be a JObject or well-formed JSON string. + */ + @JsonProperty(value = "mainTemplate") + private Object mainTemplate; + + /* + * The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or + * well-formed JSON string. + */ + @JsonProperty(value = "createUiDefinition") + private Object createUiDefinition; + + /* + * The managed application notification policy. + */ + @JsonProperty(value = "notificationPolicy") + private ApplicationNotificationPolicy notificationPolicy; + + /* + * The managed application locking policy. + */ + @JsonProperty(value = "lockingPolicy") + private ApplicationPackageLockingPolicyDefinition lockingPolicy; + + /* + * The managed application deployment policy. + */ + @JsonProperty(value = "deploymentPolicy") + private ApplicationDeploymentPolicy deploymentPolicy; + + /* + * The managed application management policy that determines publisher's + * access to the managed resource group. + */ + @JsonProperty(value = "managementPolicy") + private ApplicationManagementPolicy managementPolicy; + + /* + * The managed application provider policies. + */ + @JsonProperty(value = "policies") + private List policies; + + /** + * Get the lockLevel property: The managed application lock level. + * + * @return the lockLevel value. + */ + public ApplicationLockLevel lockLevel() { + return this.lockLevel; + } + + /** + * Set the lockLevel property: The managed application lock level. + * + * @param lockLevel the lockLevel value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withLockLevel(ApplicationLockLevel lockLevel) { + this.lockLevel = lockLevel; + return this; + } + + /** + * Get the displayName property: The managed application definition display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The managed application definition display name. + * + * @param displayName the displayName value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the isEnabled property: A value indicating whether the package is enabled or not. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: A value indicating whether the package is enabled or not. + * + * @param isEnabled the isEnabled value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the authorizations property: The managed application provider authorizations. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: The managed application provider authorizations. + * + * @param authorizations the authorizations value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withAuthorizations(List authorizations) { + this.authorizations = authorizations; + return this; + } + + /** + * Get the artifacts property: The collection of managed application artifacts. The portal will use the files + * specified as artifacts to construct the user experience of creating a managed application from a managed + * application definition. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Set the artifacts property: The collection of managed application artifacts. The portal will use the files + * specified as artifacts to construct the user experience of creating a managed application from a managed + * application definition. + * + * @param artifacts the artifacts value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withArtifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the description property: The managed application definition description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The managed application definition description. + * + * @param description the description value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the packageFileUri property: The managed application definition package file Uri. Use this element. + * + * @return the packageFileUri value. + */ + public String packageFileUri() { + return this.packageFileUri; + } + + /** + * Set the packageFileUri property: The managed application definition package file Uri. Use this element. + * + * @param packageFileUri the packageFileUri value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withPackageFileUri(String packageFileUri) { + this.packageFileUri = packageFileUri; + return this; + } + + /** + * Get the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @param storageAccountId the storageAccountId value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a + * JObject or well-formed JSON string. + * + * @return the mainTemplate value. + */ + public Object mainTemplate() { + return this.mainTemplate; + } + + /** + * Set the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a + * JObject or well-formed JSON string. + * + * @param mainTemplate the mainTemplate value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withMainTemplate(Object mainTemplate) { + this.mainTemplate = mainTemplate; + return this; + } + + /** + * Get the createUiDefinition property: The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + * + * @return the createUiDefinition value. + */ + public Object createUiDefinition() { + return this.createUiDefinition; + } + + /** + * Set the createUiDefinition property: The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + * + * @param createUiDefinition the createUiDefinition value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withCreateUiDefinition(Object createUiDefinition) { + this.createUiDefinition = createUiDefinition; + return this; + } + + /** + * Get the notificationPolicy property: The managed application notification policy. + * + * @return the notificationPolicy value. + */ + public ApplicationNotificationPolicy notificationPolicy() { + return this.notificationPolicy; + } + + /** + * Set the notificationPolicy property: The managed application notification policy. + * + * @param notificationPolicy the notificationPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy) { + this.notificationPolicy = notificationPolicy; + return this; + } + + /** + * Get the lockingPolicy property: The managed application locking policy. + * + * @return the lockingPolicy value. + */ + public ApplicationPackageLockingPolicyDefinition lockingPolicy() { + return this.lockingPolicy; + } + + /** + * Set the lockingPolicy property: The managed application locking policy. + * + * @param lockingPolicy the lockingPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy) { + this.lockingPolicy = lockingPolicy; + return this; + } + + /** + * Get the deploymentPolicy property: The managed application deployment policy. + * + * @return the deploymentPolicy value. + */ + public ApplicationDeploymentPolicy deploymentPolicy() { + return this.deploymentPolicy; + } + + /** + * Set the deploymentPolicy property: The managed application deployment policy. + * + * @param deploymentPolicy the deploymentPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy) { + this.deploymentPolicy = deploymentPolicy; + return this; + } + + /** + * Get the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @return the managementPolicy value. + */ + public ApplicationManagementPolicy managementPolicy() { + return this.managementPolicy; + } + + /** + * Set the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @param managementPolicy the managementPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withManagementPolicy(ApplicationManagementPolicy managementPolicy) { + this.managementPolicy = managementPolicy; + return this; + } + + /** + * Get the policies property: The managed application provider policies. + * + * @return the policies value. + */ + public List policies() { + return this.policies; + } + + /** + * Set the policies property: The managed application provider policies. + * + * @param policies the policies value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withPolicies(List policies) { + this.policies = policies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lockLevel() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property lockLevel in model ApplicationDefinitionProperties")); + } + if (authorizations() != null) { + authorizations().forEach(e -> e.validate()); + } + if (artifacts() != null) { + artifacts().forEach(e -> e.validate()); + } + if (notificationPolicy() != null) { + notificationPolicy().validate(); + } + if (lockingPolicy() != null) { + lockingPolicy().validate(); + } + if (deploymentPolicy() != null) { + deploymentPolicy().validate(); + } + if (managementPolicy() != null) { + managementPolicy().validate(); + } + if (policies() != null) { + policies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationInner.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationInner.java new file mode 100644 index 0000000000000..1fc8e4408f5e7 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationInner.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ApplicationArtifact; +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationClientDetails; +import com.azure.resourcemanager.solutions.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationManagementMode; +import com.azure.resourcemanager.solutions.models.ApplicationPackageContact; +import com.azure.resourcemanager.solutions.models.ApplicationPackageSupportUrls; +import com.azure.resourcemanager.solutions.models.GenericResource; +import com.azure.resourcemanager.solutions.models.Identity; +import com.azure.resourcemanager.solutions.models.Plan; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.azure.resourcemanager.solutions.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Information about managed application. */ +@Fluent +public final class ApplicationInner extends GenericResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationInner.class); + + /* + * The managed application properties. + */ + @JsonProperty(value = "properties", required = true) + private ApplicationProperties innerProperties = new ApplicationProperties(); + + /* + * The plan information. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * The kind of the managed application. Allowed values are MarketPlace and + * ServiceCatalog. + */ + @JsonProperty(value = "kind", required = true) + private String kind; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the innerProperties property: The managed application properties. + * + * @return the innerProperties value. + */ + private ApplicationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the plan property: The plan information. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The plan information. + * + * @param plan the plan value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @param kind the kind value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the managedResourceGroupId property: The managed resource group Id. + * + * @return the managedResourceGroupId value. + */ + public String managedResourceGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupId(); + } + + /** + * Set the managedResourceGroupId property: The managed resource group Id. + * + * @param managedResourceGroupId the managedResourceGroupId value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withManagedResourceGroupId(String managedResourceGroupId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withManagedResourceGroupId(managedResourceGroupId); + return this; + } + + /** + * Get the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @return the applicationDefinitionId value. + */ + public String applicationDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().applicationDefinitionId(); + } + + /** + * Set the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @param applicationDefinitionId the applicationDefinitionId value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withApplicationDefinitionId(String applicationDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withApplicationDefinitionId(applicationDefinitionId); + return this; + } + + /** + * Get the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @return the parameters value. + */ + public Object parameters() { + return this.innerProperties() == null ? null : this.innerProperties().parameters(); + } + + /** + * Set the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @param parameters the parameters value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withParameters(Object parameters) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withParameters(parameters); + return this; + } + + /** + * Get the outputs property: Name and value pairs that define the managed application outputs. + * + * @return the outputs value. + */ + public Object outputs() { + return this.innerProperties() == null ? null : this.innerProperties().outputs(); + } + + /** + * Get the provisioningState property: The managed application provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerProperties() == null ? null : this.innerProperties().billingDetails(); + } + + /** + * Get the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().jitAccessPolicy(); + } + + /** + * Set the jitAccessPolicy property: The managed application Jit access policy. + * + * @param jitAccessPolicy the jitAccessPolicy value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withJitAccessPolicy(jitAccessPolicy); + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().publisherTenantId(); + } + + /** + * Get the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.innerProperties() == null ? null : this.innerProperties().authorizations(); + } + + /** + * Get the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + public ApplicationManagementMode managementMode() { + return this.innerProperties() == null ? null : this.innerProperties().managementMode(); + } + + /** + * Get the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + public ApplicationPackageContact customerSupport() { + return this.innerProperties() == null ? null : this.innerProperties().customerSupport(); + } + + /** + * Get the supportUrls property: The read-only support URLs property that is retrieved from the application package. + * + * @return the supportUrls value. + */ + public ApplicationPackageSupportUrls supportUrls() { + return this.innerProperties() == null ? null : this.innerProperties().supportUrls(); + } + + /** + * Get the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.innerProperties() == null ? null : this.innerProperties().artifacts(); + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().updatedBy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ApplicationInner")); + } else { + innerProperties().validate(); + } + if (plan() != null) { + plan().validate(); + } + if (kind() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property kind in model ApplicationInner")); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationProperties.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationProperties.java new file mode 100644 index 0000000000000..f2c1f66bdd11f --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/ApplicationProperties.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ApplicationArtifact; +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationClientDetails; +import com.azure.resourcemanager.solutions.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationManagementMode; +import com.azure.resourcemanager.solutions.models.ApplicationPackageContact; +import com.azure.resourcemanager.solutions.models.ApplicationPackageSupportUrls; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed application properties. */ +@Fluent +public final class ApplicationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationProperties.class); + + /* + * The managed resource group Id. + */ + @JsonProperty(value = "managedResourceGroupId") + private String managedResourceGroupId; + + /* + * The fully qualified path of managed application definition Id. + */ + @JsonProperty(value = "applicationDefinitionId") + private String applicationDefinitionId; + + /* + * Name and value pairs that define the managed application parameters. It + * can be a JObject or a well formed JSON string. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /* + * Name and value pairs that define the managed application outputs. + */ + @JsonProperty(value = "outputs", access = JsonProperty.Access.WRITE_ONLY) + private Object outputs; + + /* + * The managed application provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The managed application billing details. + */ + @JsonProperty(value = "billingDetails", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationBillingDetailsDefinition billingDetails; + + /* + * The managed application Jit access policy. + */ + @JsonProperty(value = "jitAccessPolicy") + private ApplicationJitAccessPolicy jitAccessPolicy; + + /* + * The publisher tenant Id. + */ + @JsonProperty(value = "publisherTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String publisherTenantId; + + /* + * The read-only authorizations property that is retrieved from the + * application package. + */ + @JsonProperty(value = "authorizations", access = JsonProperty.Access.WRITE_ONLY) + private List authorizations; + + /* + * The managed application management mode. + */ + @JsonProperty(value = "managementMode", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationManagementMode managementMode; + + /* + * The read-only customer support property that is retrieved from the + * application package. + */ + @JsonProperty(value = "customerSupport", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationPackageContact customerSupport; + + /* + * The read-only support URLs property that is retrieved from the + * application package. + */ + @JsonProperty(value = "supportUrls", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationPackageSupportUrls supportUrls; + + /* + * The collection of managed application artifacts. + */ + @JsonProperty(value = "artifacts", access = JsonProperty.Access.WRITE_ONLY) + private List artifacts; + + /* + * The client entity that created the JIT request. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails createdBy; + + /* + * The client entity that last updated the JIT request. + */ + @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails updatedBy; + + /** + * Get the managedResourceGroupId property: The managed resource group Id. + * + * @return the managedResourceGroupId value. + */ + public String managedResourceGroupId() { + return this.managedResourceGroupId; + } + + /** + * Set the managedResourceGroupId property: The managed resource group Id. + * + * @param managedResourceGroupId the managedResourceGroupId value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withManagedResourceGroupId(String managedResourceGroupId) { + this.managedResourceGroupId = managedResourceGroupId; + return this; + } + + /** + * Get the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @return the applicationDefinitionId value. + */ + public String applicationDefinitionId() { + return this.applicationDefinitionId; + } + + /** + * Set the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @param applicationDefinitionId the applicationDefinitionId value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withApplicationDefinitionId(String applicationDefinitionId) { + this.applicationDefinitionId = applicationDefinitionId; + return this; + } + + /** + * Get the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @param parameters the parameters value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the outputs property: Name and value pairs that define the managed application outputs. + * + * @return the outputs value. + */ + public Object outputs() { + return this.outputs; + } + + /** + * Get the provisioningState property: The managed application provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + public ApplicationBillingDetailsDefinition billingDetails() { + return this.billingDetails; + } + + /** + * Get the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.jitAccessPolicy; + } + + /** + * Set the jitAccessPolicy property: The managed application Jit access policy. + * + * @param jitAccessPolicy the jitAccessPolicy value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + this.jitAccessPolicy = jitAccessPolicy; + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.publisherTenantId; + } + + /** + * Get the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Get the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + public ApplicationManagementMode managementMode() { + return this.managementMode; + } + + /** + * Get the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + public ApplicationPackageContact customerSupport() { + return this.customerSupport; + } + + /** + * Get the supportUrls property: The read-only support URLs property that is retrieved from the application package. + * + * @return the supportUrls value. + */ + public ApplicationPackageSupportUrls supportUrls() { + return this.supportUrls; + } + + /** + * Get the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.createdBy; + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.updatedBy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingDetails() != null) { + billingDetails().validate(); + } + if (jitAccessPolicy() != null) { + jitAccessPolicy().validate(); + } + if (authorizations() != null) { + authorizations().forEach(e -> e.validate()); + } + if (customerSupport() != null) { + customerSupport().validate(); + } + if (supportUrls() != null) { + supportUrls().validate(); + } + if (artifacts() != null) { + artifacts().forEach(e -> e.validate()); + } + if (createdBy() != null) { + createdBy().validate(); + } + if (updatedBy() != null) { + updatedBy().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestDefinitionInner.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestDefinitionInner.java new file mode 100644 index 0000000000000..a1e9cea91e0ce --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestDefinitionInner.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ApplicationClientDetails; +import com.azure.resourcemanager.solutions.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.solutions.models.JitRequestState; +import com.azure.resourcemanager.solutions.models.JitSchedulingPolicy; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Information about JIT request definition. */ +@Fluent +public final class JitRequestDefinitionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitRequestDefinitionInner.class); + + /* + * The JIT request properties. + */ + @JsonProperty(value = "properties") + private JitRequestProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: The JIT request properties. + * + * @return the innerProperties value. + */ + private JitRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public JitRequestDefinitionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public JitRequestDefinitionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the applicationResourceId property: The parent application id. + * + * @return the applicationResourceId value. + */ + public String applicationResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().applicationResourceId(); + } + + /** + * Set the applicationResourceId property: The parent application id. + * + * @param applicationResourceId the applicationResourceId value to set. + * @return the JitRequestDefinitionInner object itself. + */ + public JitRequestDefinitionInner withApplicationResourceId(String applicationResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new JitRequestProperties(); + } + this.innerProperties().withApplicationResourceId(applicationResourceId); + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().publisherTenantId(); + } + + /** + * Get the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @return the jitAuthorizationPolicies value. + */ + public List jitAuthorizationPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().jitAuthorizationPolicies(); + } + + /** + * Set the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @param jitAuthorizationPolicies the jitAuthorizationPolicies value to set. + * @return the JitRequestDefinitionInner object itself. + */ + public JitRequestDefinitionInner withJitAuthorizationPolicies( + List jitAuthorizationPolicies) { + if (this.innerProperties() == null) { + this.innerProperties = new JitRequestProperties(); + } + this.innerProperties().withJitAuthorizationPolicies(jitAuthorizationPolicies); + return this; + } + + /** + * Get the jitSchedulingPolicy property: The JIT request properties. + * + * @return the jitSchedulingPolicy value. + */ + public JitSchedulingPolicy jitSchedulingPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().jitSchedulingPolicy(); + } + + /** + * Set the jitSchedulingPolicy property: The JIT request properties. + * + * @param jitSchedulingPolicy the jitSchedulingPolicy value to set. + * @return the JitRequestDefinitionInner object itself. + */ + public JitRequestDefinitionInner withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new JitRequestProperties(); + } + this.innerProperties().withJitSchedulingPolicy(jitSchedulingPolicy); + return this; + } + + /** + * Get the provisioningState property: The JIT request provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the jitRequestState property: The JIT request state. + * + * @return the jitRequestState value. + */ + public JitRequestState jitRequestState() { + return this.innerProperties() == null ? null : this.innerProperties().jitRequestState(); + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().updatedBy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestDefinitionListResultInner.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestDefinitionListResultInner.java new file mode 100644 index 0000000000000..4e232d1487823 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestDefinitionListResultInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of JIT requests. */ +@Fluent +public final class JitRequestDefinitionListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitRequestDefinitionListResultInner.class); + + /* + * The array of Jit request definition. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of Jit request definition. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of Jit request definition. + * + * @param value the value value to set. + * @return the JitRequestDefinitionListResultInner object itself. + */ + public JitRequestDefinitionListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the JitRequestDefinitionListResultInner object itself. + */ + public JitRequestDefinitionListResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestProperties.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestProperties.java new file mode 100644 index 0000000000000..47c2f5e4b14c8 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/JitRequestProperties.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ApplicationClientDetails; +import com.azure.resourcemanager.solutions.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.solutions.models.JitRequestState; +import com.azure.resourcemanager.solutions.models.JitSchedulingPolicy; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about JIT request properties. */ +@Fluent +public final class JitRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitRequestProperties.class); + + /* + * The parent application id. + */ + @JsonProperty(value = "applicationResourceId", required = true) + private String applicationResourceId; + + /* + * The publisher tenant id. + */ + @JsonProperty(value = "publisherTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String publisherTenantId; + + /* + * The JIT authorization policies. + */ + @JsonProperty(value = "jitAuthorizationPolicies", required = true) + private List jitAuthorizationPolicies; + + /* + * The JIT request properties. + */ + @JsonProperty(value = "jitSchedulingPolicy", required = true) + private JitSchedulingPolicy jitSchedulingPolicy; + + /* + * The JIT request provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The JIT request state. + */ + @JsonProperty(value = "jitRequestState", access = JsonProperty.Access.WRITE_ONLY) + private JitRequestState jitRequestState; + + /* + * The client entity that created the JIT request. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails createdBy; + + /* + * The client entity that last updated the JIT request. + */ + @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails updatedBy; + + /** + * Get the applicationResourceId property: The parent application id. + * + * @return the applicationResourceId value. + */ + public String applicationResourceId() { + return this.applicationResourceId; + } + + /** + * Set the applicationResourceId property: The parent application id. + * + * @param applicationResourceId the applicationResourceId value to set. + * @return the JitRequestProperties object itself. + */ + public JitRequestProperties withApplicationResourceId(String applicationResourceId) { + this.applicationResourceId = applicationResourceId; + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.publisherTenantId; + } + + /** + * Get the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @return the jitAuthorizationPolicies value. + */ + public List jitAuthorizationPolicies() { + return this.jitAuthorizationPolicies; + } + + /** + * Set the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @param jitAuthorizationPolicies the jitAuthorizationPolicies value to set. + * @return the JitRequestProperties object itself. + */ + public JitRequestProperties withJitAuthorizationPolicies(List jitAuthorizationPolicies) { + this.jitAuthorizationPolicies = jitAuthorizationPolicies; + return this; + } + + /** + * Get the jitSchedulingPolicy property: The JIT request properties. + * + * @return the jitSchedulingPolicy value. + */ + public JitSchedulingPolicy jitSchedulingPolicy() { + return this.jitSchedulingPolicy; + } + + /** + * Set the jitSchedulingPolicy property: The JIT request properties. + * + * @param jitSchedulingPolicy the jitSchedulingPolicy value to set. + * @return the JitRequestProperties object itself. + */ + public JitRequestProperties withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy) { + this.jitSchedulingPolicy = jitSchedulingPolicy; + return this; + } + + /** + * Get the provisioningState property: The JIT request provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the jitRequestState property: The JIT request state. + * + * @return the jitRequestState value. + */ + public JitRequestState jitRequestState() { + return this.jitRequestState; + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.createdBy; + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.updatedBy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (applicationResourceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property applicationResourceId in model JitRequestProperties")); + } + if (jitAuthorizationPolicies() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property jitAuthorizationPolicies in model JitRequestProperties")); + } else { + jitAuthorizationPolicies().forEach(e -> e.validate()); + } + if (jitSchedulingPolicy() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property jitSchedulingPolicy in model JitRequestProperties")); + } else { + jitSchedulingPolicy().validate(); + } + if (createdBy() != null) { + createdBy().validate(); + } + if (updatedBy() != null) { + updatedBy().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/OperationInner.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..2f0bb9b0c7aeb --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/OperationInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.models.ActionType; +import com.azure.resourcemanager.solutions.models.OperationDisplay; +import com.azure.resourcemanager.solutions.models.Origin; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API Operation Details of a REST API operation, returned from the Resource Provider Operations API. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). + * Examples: "Microsoft.Compute/virtualMachines/write", + * "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for + * data-plane operations and "false" for ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access + * Control (RBAC) and audit logs UX. Default value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/package-info.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/package-info.java new file mode 100644 index 0000000000000..98a3578c7b6da --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for ManagedApplicationManagementClient. Managed Application Client. */ +package com.azure.resourcemanager.solutions.fluent.models; diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/package-info.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/package-info.java new file mode 100644 index 0000000000000..6c149e5fd63f9 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for ManagedApplicationManagementClient. Managed Application Client. */ +package com.azure.resourcemanager.solutions.fluent; diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionImpl.java new file mode 100644 index 0000000000000..d50e32fafc2ea --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionPatchable; +import com.azure.resourcemanager.solutions.models.ApplicationDeploymentPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationLockLevel; +import com.azure.resourcemanager.solutions.models.ApplicationManagementPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationNotificationPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationPackageLockingPolicyDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationPolicy; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.azure.resourcemanager.solutions.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ApplicationDefinitionImpl + implements ApplicationDefinition, ApplicationDefinition.Definition, ApplicationDefinition.Update { + private ApplicationDefinitionInner innerObject; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ApplicationLockLevel lockLevel() { + return this.innerModel().lockLevel(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public List authorizations() { + List inner = this.innerModel().authorizations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List artifacts() { + List inner = this.innerModel().artifacts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String description() { + return this.innerModel().description(); + } + + public String packageFileUri() { + return this.innerModel().packageFileUri(); + } + + public String storageAccountId() { + return this.innerModel().storageAccountId(); + } + + public Object mainTemplate() { + return this.innerModel().mainTemplate(); + } + + public Object createUiDefinition() { + return this.innerModel().createUiDefinition(); + } + + public ApplicationNotificationPolicy notificationPolicy() { + return this.innerModel().notificationPolicy(); + } + + public ApplicationPackageLockingPolicyDefinition lockingPolicy() { + return this.innerModel().lockingPolicy(); + } + + public ApplicationDeploymentPolicy deploymentPolicy() { + return this.innerModel().deploymentPolicy(); + } + + public ApplicationManagementPolicy managementPolicy() { + return this.innerModel().managementPolicy(); + } + + public List policies() { + List inner = this.innerModel().policies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ApplicationDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String applicationDefinitionName; + + private ApplicationDefinitionPatchable updateParameters; + + public ApplicationDefinitionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ApplicationDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationDefinitions() + .createOrUpdate(resourceGroupName, applicationDefinitionName, this.innerModel(), Context.NONE); + return this; + } + + public ApplicationDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationDefinitions() + .createOrUpdate(resourceGroupName, applicationDefinitionName, this.innerModel(), context); + return this; + } + + ApplicationDefinitionImpl( + String name, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = new ApplicationDefinitionInner(); + this.serviceManager = serviceManager; + this.applicationDefinitionName = name; + } + + public ApplicationDefinitionImpl update() { + this.updateParameters = new ApplicationDefinitionPatchable(); + return this; + } + + public ApplicationDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationDefinitions() + .updateWithResponse(resourceGroupName, applicationDefinitionName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public ApplicationDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationDefinitions() + .updateWithResponse(resourceGroupName, applicationDefinitionName, updateParameters, context) + .getValue(); + return this; + } + + ApplicationDefinitionImpl( + ApplicationDefinitionInner innerObject, + com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.applicationDefinitionName = Utils.getValueFromIdByName(innerObject.id(), "applicationDefinitions"); + } + + public ApplicationDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationDefinitions() + .getByResourceGroupWithResponse(resourceGroupName, applicationDefinitionName, Context.NONE) + .getValue(); + return this; + } + + public ApplicationDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationDefinitions() + .getByResourceGroupWithResponse(resourceGroupName, applicationDefinitionName, context) + .getValue(); + return this; + } + + public ApplicationDefinitionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ApplicationDefinitionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ApplicationDefinitionImpl withLockLevel(ApplicationLockLevel lockLevel) { + this.innerModel().withLockLevel(lockLevel); + return this; + } + + public ApplicationDefinitionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ApplicationDefinitionImpl withManagedBy(String managedBy) { + this.innerModel().withManagedBy(managedBy); + return this; + } + + public ApplicationDefinitionImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public ApplicationDefinitionImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public ApplicationDefinitionImpl withIsEnabled(Boolean isEnabled) { + this.innerModel().withIsEnabled(isEnabled); + return this; + } + + public ApplicationDefinitionImpl withAuthorizations(List authorizations) { + this.innerModel().withAuthorizations(authorizations); + return this; + } + + public ApplicationDefinitionImpl withArtifacts(List artifacts) { + this.innerModel().withArtifacts(artifacts); + return this; + } + + public ApplicationDefinitionImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public ApplicationDefinitionImpl withPackageFileUri(String packageFileUri) { + this.innerModel().withPackageFileUri(packageFileUri); + return this; + } + + public ApplicationDefinitionImpl withStorageAccountId(String storageAccountId) { + this.innerModel().withStorageAccountId(storageAccountId); + return this; + } + + public ApplicationDefinitionImpl withMainTemplate(Object mainTemplate) { + this.innerModel().withMainTemplate(mainTemplate); + return this; + } + + public ApplicationDefinitionImpl withCreateUiDefinition(Object createUiDefinition) { + this.innerModel().withCreateUiDefinition(createUiDefinition); + return this; + } + + public ApplicationDefinitionImpl withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy) { + this.innerModel().withNotificationPolicy(notificationPolicy); + return this; + } + + public ApplicationDefinitionImpl withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy) { + this.innerModel().withLockingPolicy(lockingPolicy); + return this; + } + + public ApplicationDefinitionImpl withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy) { + this.innerModel().withDeploymentPolicy(deploymentPolicy); + return this; + } + + public ApplicationDefinitionImpl withManagementPolicy(ApplicationManagementPolicy managementPolicy) { + this.innerModel().withManagementPolicy(managementPolicy); + return this; + } + + public ApplicationDefinitionImpl withPolicies(List policies) { + this.innerModel().withPolicies(policies); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionsClientImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionsClientImpl.java new file mode 100644 index 0000000000000..70ab64f6b9c02 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionsClientImpl.java @@ -0,0 +1,1498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.solutions.fluent.ApplicationDefinitionsClient; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionListResult; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitionPatchable; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationDefinitionsClient. */ +public final class ApplicationDefinitionsClientImpl implements ApplicationDefinitionsClient { + private final ClientLogger logger = new ClientLogger(ApplicationDefinitionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApplicationDefinitionsService service; + + /** The service client containing this operation class. */ + private final ManagedApplicationManagementClientImpl client; + + /** + * Initializes an instance of ApplicationDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationDefinitionsClientImpl(ManagedApplicationManagementClientImpl client) { + this.service = + RestProxy + .create(ApplicationDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedApplicationManagementClientApplicationDefinitions to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedApplicationMa") + private interface ApplicationDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationDefinitionName") String applicationDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationDefinitionName") String applicationDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationDefinitionName") String applicationDefinitionName, + @BodyParam("application/json") ApplicationDefinitionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationDefinitionName") String applicationDefinitionName, + @BodyParam("application/json") ApplicationDefinitionPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applicationDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applicationDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationDefinitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + accept, + context); + } + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String applicationDefinitionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationDefinitionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner getByResourceGroup(String resourceGroupName, String applicationDefinitionName) { + return getByResourceGroupAsync(resourceGroupName, applicationDefinitionName).block(); + } + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationDefinitionName, context).block(); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String applicationDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String applicationDefinitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + accept, + context); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String applicationDefinitionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, applicationDefinitionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String applicationDefinitionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, applicationDefinitionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String applicationDefinitionName) { + return beginDeleteAsync(resourceGroupName, applicationDefinitionName).getSyncPoller(); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String applicationDefinitionName, Context context) { + return beginDeleteAsync(resourceGroupName, applicationDefinitionName, context).getSyncPoller(); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String applicationDefinitionName) { + return beginDeleteAsync(resourceGroupName, applicationDefinitionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String applicationDefinitionName, Context context) { + return beginDeleteAsync(resourceGroupName, applicationDefinitionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String applicationDefinitionName) { + deleteAsync(resourceGroupName, applicationDefinitionName).block(); + } + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String applicationDefinitionName, Context context) { + deleteAsync(resourceGroupName, applicationDefinitionName, context).block(); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationDefinitionInner.class, + ApplicationDefinitionInner.class, + this.client.getContext()); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationDefinitionInner.class, + ApplicationDefinitionInner.class, + context); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters).getSyncPoller(); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner createOrUpdate( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { + return createOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters).block(); + } + + /** + * Creates a new managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner createOrUpdate( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, context).block(); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionPatchable parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + return updateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner update( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + return updateAsync(resourceGroupName, applicationDefinitionName, parameters).block(); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionPatchable parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context).block(); + } + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets all the application definitions within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the application definitions within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the application definitions within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the application definitions within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the application definitions within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all the application definitions within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionsImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionsImpl.java new file mode 100644 index 0000000000000..1d3cba67e5ef3 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationDefinitionsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.ApplicationDefinitionsClient; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.solutions.models.ApplicationDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationDefinitions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationDefinitionsImpl implements ApplicationDefinitions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDefinitionsImpl.class); + + private final ApplicationDefinitionsClient innerClient; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public ApplicationDefinitionsImpl( + ApplicationDefinitionsClient innerClient, + com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ApplicationDefinition getByResourceGroup(String resourceGroupName, String applicationDefinitionName) { + ApplicationDefinitionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, applicationDefinitionName); + if (inner != null) { + return new ApplicationDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, applicationDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String applicationDefinitionName) { + this.serviceClient().delete(resourceGroupName, applicationDefinitionName); + } + + public void delete(String resourceGroupName, String applicationDefinitionName, Context context) { + this.serviceClient().delete(resourceGroupName, applicationDefinitionName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); + } + + public ApplicationDefinition getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationDefinitionName = Utils.getValueFromIdByName(id, "applicationDefinitions"); + if (applicationDefinitionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationDefinitions'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, applicationDefinitionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationDefinitionName = Utils.getValueFromIdByName(id, "applicationDefinitions"); + if (applicationDefinitionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationDefinitions'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationDefinitionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationDefinitionName = Utils.getValueFromIdByName(id, "applicationDefinitions"); + if (applicationDefinitionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationDefinitions'.", + id))); + } + this.delete(resourceGroupName, applicationDefinitionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationDefinitionName = Utils.getValueFromIdByName(id, "applicationDefinitions"); + if (applicationDefinitionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationDefinitions'.", + id))); + } + this.delete(resourceGroupName, applicationDefinitionName, context); + } + + private ApplicationDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } + + public ApplicationDefinitionImpl define(String name) { + return new ApplicationDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationImpl.java new file mode 100644 index 0000000000000..0142f1a4d051e --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationImpl.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationInner; +import com.azure.resourcemanager.solutions.models.Application; +import com.azure.resourcemanager.solutions.models.ApplicationArtifact; +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.solutions.models.ApplicationClientDetails; +import com.azure.resourcemanager.solutions.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.solutions.models.ApplicationManagementMode; +import com.azure.resourcemanager.solutions.models.ApplicationPackageContact; +import com.azure.resourcemanager.solutions.models.ApplicationPackageSupportUrls; +import com.azure.resourcemanager.solutions.models.ApplicationPatchable; +import com.azure.resourcemanager.solutions.models.Identity; +import com.azure.resourcemanager.solutions.models.Plan; +import com.azure.resourcemanager.solutions.models.PlanPatchable; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import com.azure.resourcemanager.solutions.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ApplicationImpl implements Application, Application.Definition, Application.Update { + private ApplicationInner innerObject; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public String managedResourceGroupId() { + return this.innerModel().managedResourceGroupId(); + } + + public String applicationDefinitionId() { + return this.innerModel().applicationDefinitionId(); + } + + public Object parameters() { + return this.innerModel().parameters(); + } + + public Object outputs() { + return this.innerModel().outputs(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerModel().billingDetails(); + } + + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerModel().jitAccessPolicy(); + } + + public String publisherTenantId() { + return this.innerModel().publisherTenantId(); + } + + public List authorizations() { + List inner = this.innerModel().authorizations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationManagementMode managementMode() { + return this.innerModel().managementMode(); + } + + public ApplicationPackageContact customerSupport() { + return this.innerModel().customerSupport(); + } + + public ApplicationPackageSupportUrls supportUrls() { + return this.innerModel().supportUrls(); + } + + public List artifacts() { + List inner = this.innerModel().artifacts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationClientDetails createdBy() { + return this.innerModel().createdBy(); + } + + public ApplicationClientDetails updatedBy() { + return this.innerModel().updatedBy(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ApplicationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String applicationName; + + private ApplicationPatchable updateParameters; + + public ApplicationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Application create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createOrUpdate(resourceGroupName, applicationName, this.innerModel(), Context.NONE); + return this; + } + + public Application create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createOrUpdate(resourceGroupName, applicationName, this.innerModel(), context); + return this; + } + + ApplicationImpl(String name, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = new ApplicationInner(); + this.serviceManager = serviceManager; + this.applicationName = name; + } + + public ApplicationImpl update() { + this.updateParameters = new ApplicationPatchable(); + return this; + } + + public Application apply() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .updateWithResponse(resourceGroupName, applicationName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Application apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .updateWithResponse(resourceGroupName, applicationName, updateParameters, context) + .getValue(); + return this; + } + + ApplicationImpl( + ApplicationInner innerObject, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.applicationName = Utils.getValueFromIdByName(innerObject.id(), "applications"); + } + + public Application refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getByResourceGroupWithResponse(resourceGroupName, applicationName, Context.NONE) + .getValue(); + return this; + } + + public Application refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getByResourceGroupWithResponse(resourceGroupName, applicationName, context) + .getValue(); + return this; + } + + public void refreshPermissions() { + serviceManager.applications().refreshPermissions(resourceGroupName, applicationName); + } + + public void refreshPermissions(Context context) { + serviceManager.applications().refreshPermissions(resourceGroupName, applicationName, context); + } + + public void listAllowedUpgradePlans() { + serviceManager.applications().listAllowedUpgradePlans(resourceGroupName, applicationName); + } + + public Response listAllowedUpgradePlansWithResponse(Context context) { + return serviceManager + .applications() + .listAllowedUpgradePlansWithResponse(resourceGroupName, applicationName, context); + } + + public ApplicationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ApplicationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ApplicationImpl withKind(String kind) { + if (isInCreateMode()) { + this.innerModel().withKind(kind); + return this; + } else { + this.updateParameters.withKind(kind); + return this; + } + } + + public ApplicationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ApplicationImpl withManagedBy(String managedBy) { + if (isInCreateMode()) { + this.innerModel().withManagedBy(managedBy); + return this; + } else { + this.updateParameters.withManagedBy(managedBy); + return this; + } + } + + public ApplicationImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ApplicationImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } + + public ApplicationImpl withIdentity(Identity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ApplicationImpl withManagedResourceGroupId(String managedResourceGroupId) { + if (isInCreateMode()) { + this.innerModel().withManagedResourceGroupId(managedResourceGroupId); + return this; + } else { + this.updateParameters.withManagedResourceGroupId(managedResourceGroupId); + return this; + } + } + + public ApplicationImpl withApplicationDefinitionId(String applicationDefinitionId) { + if (isInCreateMode()) { + this.innerModel().withApplicationDefinitionId(applicationDefinitionId); + return this; + } else { + this.updateParameters.withApplicationDefinitionId(applicationDefinitionId); + return this; + } + } + + public ApplicationImpl withParameters(Object parameters) { + if (isInCreateMode()) { + this.innerModel().withParameters(parameters); + return this; + } else { + this.updateParameters.withParameters(parameters); + return this; + } + } + + public ApplicationImpl withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + if (isInCreateMode()) { + this.innerModel().withJitAccessPolicy(jitAccessPolicy); + return this; + } else { + this.updateParameters.withJitAccessPolicy(jitAccessPolicy); + return this; + } + } + + public ApplicationImpl withPlan(PlanPatchable plan) { + this.updateParameters.withPlan(plan); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationsClientImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationsClientImpl.java new file mode 100644 index 0000000000000..d6fe8c7b4984f --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationsClientImpl.java @@ -0,0 +1,1878 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.solutions.fluent.ApplicationsClient; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationInner; +import com.azure.resourcemanager.solutions.models.ApplicationListResult; +import com.azure.resourcemanager.solutions.models.ApplicationPatchable; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public final class ApplicationsClientImpl implements ApplicationsClient { + private final ClientLogger logger = new ClientLogger(ApplicationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApplicationsService service; + + /** The service client containing this operation class. */ + private final ManagedApplicationManagementClientImpl client; + + /** + * Initializes an instance of ApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationsClientImpl(ManagedApplicationManagementClientImpl client) { + this.service = + RestProxy.create(ApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedApplicationManagementClientApplications to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedApplicationMa") + private interface ApplicationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications/{applicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications/{applicationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications/{applicationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @BodyParam("application/json") ApplicationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications/{applicationName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @BodyParam("application/json") ApplicationPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications/{applicationName}/refreshPermissions") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> refreshPermissions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/applications/{applicationName}/listAllowedUpgradePlans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllowedUpgradePlans( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context); + } + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String applicationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner getByResourceGroup(String resourceGroupName, String applicationName) { + return getByResourceGroupAsync(resourceGroupName, applicationName).block(); + } + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationName, context).block(); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String applicationName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, applicationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String applicationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, applicationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String applicationName) { + return beginDeleteAsync(resourceGroupName, applicationName).getSyncPoller(); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String applicationName, Context context) { + return beginDeleteAsync(resourceGroupName, applicationName, context).getSyncPoller(); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String applicationName) { + return beginDeleteAsync(resourceGroupName, applicationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String applicationName, Context context) { + return beginDeleteAsync(resourceGroupName, applicationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String applicationName) { + deleteAsync(resourceGroupName, applicationName).block(); + } + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String applicationName, Context context) { + deleteAsync(resourceGroupName, applicationName, context).block(); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String applicationName, ApplicationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + parameters, + accept, + context); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String applicationName, ApplicationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, applicationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationInner.class, + ApplicationInner.class, + this.client.getContext()); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, applicationName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ApplicationInner.class, ApplicationInner.class, context); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationInner> beginCreateOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationName, parameters).getSyncPoller(); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationInner> beginCreateOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String applicationName, ApplicationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, applicationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner createOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters) { + return createOrUpdateAsync(resourceGroupName, applicationName, parameters).block(); + } + + /** + * Creates a new managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner createOrUpdate( + String resourceGroupName, String applicationName, ApplicationInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, applicationName, parameters, context).block(); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationName, ApplicationPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationName, ApplicationPatchable parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + parameters, + accept, + context); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationName, ApplicationPatchable parameters) { + return updateWithResponseAsync(resourceGroupName, applicationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String applicationName) { + final ApplicationPatchable parameters = null; + return updateWithResponseAsync(resourceGroupName, applicationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner update(String resourceGroupName, String applicationName) { + final ApplicationPatchable parameters = null; + return updateAsync(resourceGroupName, applicationName, parameters).block(); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String applicationName, ApplicationPatchable parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, applicationName, parameters, context).block(); + } + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets all the applications within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the applications within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the applications within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the applications within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the applications within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all the applications within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshPermissionsWithResponseAsync( + String resourceGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .refreshPermissions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshPermissionsWithResponseAsync( + String resourceGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .refreshPermissions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshPermissionsAsync( + String resourceGroupName, String applicationName) { + Mono>> mono = refreshPermissionsWithResponseAsync(resourceGroupName, applicationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshPermissionsAsync( + String resourceGroupName, String applicationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + refreshPermissionsWithResponseAsync(resourceGroupName, applicationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshPermissions( + String resourceGroupName, String applicationName) { + return beginRefreshPermissionsAsync(resourceGroupName, applicationName).getSyncPoller(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshPermissions( + String resourceGroupName, String applicationName, Context context) { + return beginRefreshPermissionsAsync(resourceGroupName, applicationName, context).getSyncPoller(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshPermissionsAsync(String resourceGroupName, String applicationName) { + return beginRefreshPermissionsAsync(resourceGroupName, applicationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshPermissionsAsync(String resourceGroupName, String applicationName, Context context) { + return beginRefreshPermissionsAsync(resourceGroupName, applicationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshPermissions(String resourceGroupName, String applicationName) { + refreshPermissionsAsync(resourceGroupName, applicationName).block(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshPermissions(String resourceGroupName, String applicationName, Context context) { + refreshPermissionsAsync(resourceGroupName, applicationName, context).block(); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllowedUpgradePlansWithResponseAsync( + String resourceGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAllowedUpgradePlans( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllowedUpgradePlansWithResponseAsync( + String resourceGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllowedUpgradePlans( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAllowedUpgradePlansAsync(String resourceGroupName, String applicationName) { + return listAllowedUpgradePlansWithResponseAsync(resourceGroupName, applicationName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void listAllowedUpgradePlans(String resourceGroupName, String applicationName) { + listAllowedUpgradePlansAsync(resourceGroupName, applicationName).block(); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context) { + return listAllowedUpgradePlansWithResponseAsync(resourceGroupName, applicationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed applications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed applications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed applications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed applications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationsImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationsImpl.java new file mode 100644 index 0000000000000..16900609747ee --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ApplicationsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.ApplicationsClient; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationInner; +import com.azure.resourcemanager.solutions.models.Application; +import com.azure.resourcemanager.solutions.models.Applications; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationsImpl implements Applications { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationsImpl.class); + + private final ApplicationsClient innerClient; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public ApplicationsImpl( + ApplicationsClient innerClient, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Application getByResourceGroup(String resourceGroupName, String applicationName) { + ApplicationInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, applicationName); + if (inner != null) { + return new ApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, applicationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String applicationName) { + this.serviceClient().delete(resourceGroupName, applicationName); + } + + public void delete(String resourceGroupName, String applicationName, Context context) { + this.serviceClient().delete(resourceGroupName, applicationName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public void refreshPermissions(String resourceGroupName, String applicationName) { + this.serviceClient().refreshPermissions(resourceGroupName, applicationName); + } + + public void refreshPermissions(String resourceGroupName, String applicationName, Context context) { + this.serviceClient().refreshPermissions(resourceGroupName, applicationName, context); + } + + public void listAllowedUpgradePlans(String resourceGroupName, String applicationName) { + this.serviceClient().listAllowedUpgradePlans(resourceGroupName, applicationName); + } + + public Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context) { + return this.serviceClient().listAllowedUpgradePlansWithResponse(resourceGroupName, applicationName, context); + } + + public Application getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.delete(resourceGroupName, applicationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.delete(resourceGroupName, applicationName, context); + } + + private ApplicationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } + + public ApplicationImpl define(String name) { + return new ApplicationImpl(name, this.manager()); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestDefinitionImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestDefinitionImpl.java new file mode 100644 index 0000000000000..3046553734eef --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestDefinitionImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.solutions.models.ApplicationClientDetails; +import com.azure.resourcemanager.solutions.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.solutions.models.JitRequestDefinition; +import com.azure.resourcemanager.solutions.models.JitRequestPatchable; +import com.azure.resourcemanager.solutions.models.JitRequestState; +import com.azure.resourcemanager.solutions.models.JitSchedulingPolicy; +import com.azure.resourcemanager.solutions.models.ProvisioningState; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class JitRequestDefinitionImpl + implements JitRequestDefinition, JitRequestDefinition.Definition, JitRequestDefinition.Update { + private JitRequestDefinitionInner innerObject; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String applicationResourceId() { + return this.innerModel().applicationResourceId(); + } + + public String publisherTenantId() { + return this.innerModel().publisherTenantId(); + } + + public List jitAuthorizationPolicies() { + List inner = this.innerModel().jitAuthorizationPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public JitSchedulingPolicy jitSchedulingPolicy() { + return this.innerModel().jitSchedulingPolicy(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public JitRequestState jitRequestState() { + return this.innerModel().jitRequestState(); + } + + public ApplicationClientDetails createdBy() { + return this.innerModel().createdBy(); + } + + public ApplicationClientDetails updatedBy() { + return this.innerModel().updatedBy(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public JitRequestDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String jitRequestName; + + private JitRequestPatchable updateParameters; + + public JitRequestDefinitionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public JitRequestDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .createOrUpdate(resourceGroupName, jitRequestName, this.innerModel(), Context.NONE); + return this; + } + + public JitRequestDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .createOrUpdate(resourceGroupName, jitRequestName, this.innerModel(), context); + return this; + } + + JitRequestDefinitionImpl( + String name, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = new JitRequestDefinitionInner(); + this.serviceManager = serviceManager; + this.jitRequestName = name; + } + + public JitRequestDefinitionImpl update() { + this.updateParameters = new JitRequestPatchable(); + return this; + } + + public JitRequestDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .updateWithResponse(resourceGroupName, jitRequestName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public JitRequestDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .updateWithResponse(resourceGroupName, jitRequestName, updateParameters, context) + .getValue(); + return this; + } + + JitRequestDefinitionImpl( + JitRequestDefinitionInner innerObject, + com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.jitRequestName = Utils.getValueFromIdByName(innerObject.id(), "jitRequests"); + } + + public JitRequestDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .getByResourceGroupWithResponse(resourceGroupName, jitRequestName, Context.NONE) + .getValue(); + return this; + } + + public JitRequestDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .getByResourceGroupWithResponse(resourceGroupName, jitRequestName, context) + .getValue(); + return this; + } + + public JitRequestDefinitionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public JitRequestDefinitionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public JitRequestDefinitionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public JitRequestDefinitionImpl withApplicationResourceId(String applicationResourceId) { + this.innerModel().withApplicationResourceId(applicationResourceId); + return this; + } + + public JitRequestDefinitionImpl withJitAuthorizationPolicies( + List jitAuthorizationPolicies) { + this.innerModel().withJitAuthorizationPolicies(jitAuthorizationPolicies); + return this; + } + + public JitRequestDefinitionImpl withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy) { + this.innerModel().withJitSchedulingPolicy(jitSchedulingPolicy); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestDefinitionListResultImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestDefinitionListResultImpl.java new file mode 100644 index 0000000000000..61b67333d5581 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestDefinitionListResultImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.solutions.models.JitRequestDefinition; +import com.azure.resourcemanager.solutions.models.JitRequestDefinitionListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class JitRequestDefinitionListResultImpl implements JitRequestDefinitionListResult { + private JitRequestDefinitionListResultInner innerObject; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + JitRequestDefinitionListResultImpl( + JitRequestDefinitionListResultInner innerObject, + com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new JitRequestDefinitionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public JitRequestDefinitionListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestsClientImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestsClientImpl.java new file mode 100644 index 0000000000000..f2ddba0125dd7 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestsClientImpl.java @@ -0,0 +1,1132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.solutions.fluent.JitRequestsClient; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.solutions.models.JitRequestPatchable; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JitRequestsClient. */ +public final class JitRequestsClientImpl implements JitRequestsClient { + private final ClientLogger logger = new ClientLogger(JitRequestsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JitRequestsService service; + + /** The service client containing this operation class. */ + private final ManagedApplicationManagementClientImpl client; + + /** + * Initializes an instance of JitRequestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JitRequestsClientImpl(ManagedApplicationManagementClientImpl client) { + this.service = + RestProxy.create(JitRequestsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedApplicationManagementClientJitRequests to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedApplicationMa") + private interface JitRequestsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/jitRequests/{jitRequestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/jitRequests/{jitRequestName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @BodyParam("application/json") JitRequestDefinitionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/jitRequests/{jitRequestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @BodyParam("application/json") JitRequestPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/jitRequests/{jitRequestName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" + + "/jitRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String jitRequestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String jitRequestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String jitRequestName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, jitRequestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner getByResourceGroup(String resourceGroupName, String jitRequestName) { + return getByResourceGroupAsync(resourceGroupName, jitRequestName).block(); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, jitRequestName, context).block(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JitRequestDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, jitRequestName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JitRequestDefinitionInner.class, + JitRequestDefinitionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JitRequestDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, jitRequestName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JitRequestDefinitionInner.class, + JitRequestDefinitionInner.class, + context); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters).getSyncPoller(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + return createOrUpdateAsync(resourceGroupName, jitRequestName, parameters).block(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, jitRequestName, parameters, context).block(); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters) { + return updateWithResponseAsync(resourceGroupName, jitRequestName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner update( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters) { + return updateAsync(resourceGroupName, jitRequestName, parameters).block(); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, jitRequestName, parameters, context).block(); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String jitRequestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String jitRequestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String jitRequestName) { + return deleteWithResponseAsync(resourceGroupName, jitRequestName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String jitRequestName) { + deleteAsync(resourceGroupName, jitRequestName).block(); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String jitRequestName, Context context) { + return deleteWithResponseAsync(resourceGroupName, jitRequestName, context).block(); + } + + /** + * Retrieves all JIT requests within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves all JIT requests within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listBySubscriptionAsync() { + return listBySubscriptionWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves all JIT requests within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionListResultInner listBySubscription() { + return listBySubscriptionAsync().block(); + } + + /** + * Retrieves all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listBySubscriptionWithResponse(Context context) { + return listBySubscriptionWithResponseAsync(context).block(); + } + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupWithResponseAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupWithResponseAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithResponseAsync(resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionListResultInner listByResourceGroup(String resourceGroupName) { + return listByResourceGroupAsync(resourceGroupName).block(); + } + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByResourceGroupWithResponse( + String resourceGroupName, Context context) { + return listByResourceGroupWithResponseAsync(resourceGroupName, context).block(); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestsImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestsImpl.java new file mode 100644 index 0000000000000..e82f04db25e1e --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/JitRequestsImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.JitRequestsClient; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.solutions.models.JitRequestDefinition; +import com.azure.resourcemanager.solutions.models.JitRequestDefinitionListResult; +import com.azure.resourcemanager.solutions.models.JitRequests; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JitRequestsImpl implements JitRequests { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitRequestsImpl.class); + + private final JitRequestsClient innerClient; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public JitRequestsImpl( + JitRequestsClient innerClient, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public JitRequestDefinition getByResourceGroup(String resourceGroupName, String jitRequestName) { + JitRequestDefinitionInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, jitRequestName); + if (inner != null) { + return new JitRequestDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, jitRequestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitRequestDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String jitRequestName) { + this.serviceClient().delete(resourceGroupName, jitRequestName); + } + + public Response deleteWithResponse(String resourceGroupName, String jitRequestName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, jitRequestName, context); + } + + public JitRequestDefinitionListResult listBySubscription() { + JitRequestDefinitionListResultInner inner = this.serviceClient().listBySubscription(); + if (inner != null) { + return new JitRequestDefinitionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listBySubscriptionWithResponse(Context context) { + Response inner = + this.serviceClient().listBySubscriptionWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitRequestDefinitionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JitRequestDefinitionListResult listByResourceGroup(String resourceGroupName) { + JitRequestDefinitionListResultInner inner = this.serviceClient().listByResourceGroup(resourceGroupName); + if (inner != null) { + return new JitRequestDefinitionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByResourceGroupWithResponse( + String resourceGroupName, Context context) { + Response inner = + this.serviceClient().listByResourceGroupWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitRequestDefinitionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JitRequestDefinition getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, jitRequestName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, jitRequestName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + this.deleteWithResponse(resourceGroupName, jitRequestName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + return this.deleteWithResponse(resourceGroupName, jitRequestName, context); + } + + private JitRequestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } + + public JitRequestDefinitionImpl define(String name) { + return new JitRequestDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ManagedApplicationManagementClientBuilder.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ManagedApplicationManagementClientBuilder.java new file mode 100644 index 0000000000000..aeebdb86a9563 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ManagedApplicationManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ManagedApplicationManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ManagedApplicationManagementClientImpl.class}) +public final class ManagedApplicationManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the ManagedApplicationManagementClientBuilder. + */ + public ManagedApplicationManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ManagedApplicationManagementClientBuilder. + */ + public ManagedApplicationManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ManagedApplicationManagementClientBuilder. + */ + public ManagedApplicationManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ManagedApplicationManagementClientBuilder. + */ + public ManagedApplicationManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ManagedApplicationManagementClientBuilder. + */ + public ManagedApplicationManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ManagedApplicationManagementClientBuilder. + */ + public ManagedApplicationManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagedApplicationManagementClientImpl with the provided parameters. + * + * @return an instance of ManagedApplicationManagementClientImpl. + */ + public ManagedApplicationManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ManagedApplicationManagementClientImpl client = + new ManagedApplicationManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ManagedApplicationManagementClientImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ManagedApplicationManagementClientImpl.java new file mode 100644 index 0000000000000..260add4f36a63 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ManagedApplicationManagementClientImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.solutions.fluent.ApplicationDefinitionsClient; +import com.azure.resourcemanager.solutions.fluent.ApplicationsClient; +import com.azure.resourcemanager.solutions.fluent.JitRequestsClient; +import com.azure.resourcemanager.solutions.fluent.ManagedApplicationManagementClient; +import com.azure.resourcemanager.solutions.fluent.ResourceProvidersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ManagedApplicationManagementClientImpl type. */ +@ServiceClient(builder = ManagedApplicationManagementClientBuilder.class) +public final class ManagedApplicationManagementClientImpl implements ManagedApplicationManagementClient { + private final ClientLogger logger = new ClientLogger(ManagedApplicationManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The ApplicationsClient object to access its operations. */ + private final ApplicationsClient applications; + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + public ApplicationsClient getApplications() { + return this.applications; + } + + /** The ApplicationDefinitionsClient object to access its operations. */ + private final ApplicationDefinitionsClient applicationDefinitions; + + /** + * Gets the ApplicationDefinitionsClient object to access its operations. + * + * @return the ApplicationDefinitionsClient object. + */ + public ApplicationDefinitionsClient getApplicationDefinitions() { + return this.applicationDefinitions; + } + + /** The JitRequestsClient object to access its operations. */ + private final JitRequestsClient jitRequests; + + /** + * Gets the JitRequestsClient object to access its operations. + * + * @return the JitRequestsClient object. + */ + public JitRequestsClient getJitRequests() { + return this.jitRequests; + } + + /** + * Initializes an instance of ManagedApplicationManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + ManagedApplicationManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-07-01"; + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.applicationDefinitions = new ApplicationDefinitionsClientImpl(this); + this.jitRequests = new JitRequestsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/OperationImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/OperationImpl.java new file mode 100644 index 0000000000000..2686d116c4df0 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.resourcemanager.solutions.fluent.models.OperationInner; +import com.azure.resourcemanager.solutions.models.ActionType; +import com.azure.resourcemanager.solutions.models.Operation; +import com.azure.resourcemanager.solutions.models.OperationDisplay; +import com.azure.resourcemanager.solutions.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ResourceProvidersClientImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..f05aaea78f7ce --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.solutions.fluent.models.OperationInner; +import com.azure.resourcemanager.solutions.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final ManagedApplicationManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(ManagedApplicationManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedApplicationManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedApplicationMa") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Solutions/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperationsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync() { + return new PagedFlux<>( + () -> listOperationsSinglePageAsync(), nextLink -> listOperationsNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync(Context context) { + return new PagedFlux<>( + () -> listOperationsSinglePageAsync(context), + nextLink -> listOperationsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations() { + return new PagedIterable<>(listOperationsAsync()); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations(Context context) { + return new PagedIterable<>(listOperationsAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listOperationsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOperationsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ResourceProvidersImpl.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..0b36edeab60f3 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/ResourceProvidersImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.solutions.fluent.models.OperationInner; +import com.azure.resourcemanager.solutions.models.Operation; +import com.azure.resourcemanager.solutions.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.solutions.ManagedApplicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listOperations() { + PagedIterable inner = this.serviceClient().listOperations(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.solutions.ManagedApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/Utils.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/Utils.java new file mode 100644 index 0000000000000..0ad95d4364135 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/package-info.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/package-info.java new file mode 100644 index 0000000000000..a1a5122999e9d --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for ManagedApplicationManagementClient. Managed Application Client. */ +package com.azure.resourcemanager.solutions.implementation; diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ActionType.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ActionType.java new file mode 100644 index 0000000000000..2d4db3797dd6f --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ActionType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionType. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** @return known ActionType values. */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Application.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Application.java new file mode 100644 index 0000000000000..d0b6e54563bab --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Application.java @@ -0,0 +1,591 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Application. */ +public interface Application { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the managedBy property: ID of the resource that manages this resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the sku property: The SKU of the resource. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the plan property: The plan information. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the managedResourceGroupId property: The managed resource group Id. + * + * @return the managedResourceGroupId value. + */ + String managedResourceGroupId(); + + /** + * Gets the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @return the applicationDefinitionId value. + */ + String applicationDefinitionId(); + + /** + * Gets the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @return the parameters value. + */ + Object parameters(); + + /** + * Gets the outputs property: Name and value pairs that define the managed application outputs. + * + * @return the outputs value. + */ + Object outputs(); + + /** + * Gets the provisioningState property: The managed application provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + ApplicationBillingDetailsDefinition billingDetails(); + + /** + * Gets the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + ApplicationJitAccessPolicy jitAccessPolicy(); + + /** + * Gets the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + String publisherTenantId(); + + /** + * Gets the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + List authorizations(); + + /** + * Gets the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + ApplicationManagementMode managementMode(); + + /** + * Gets the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + ApplicationPackageContact customerSupport(); + + /** + * Gets the supportUrls property: The read-only support URLs property that is retrieved from the application + * package. + * + * @return the supportUrls value. + */ + ApplicationPackageSupportUrls supportUrls(); + + /** + * Gets the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + List artifacts(); + + /** + * Gets the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + ApplicationClientDetails createdBy(); + + /** + * Gets the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + ApplicationClientDetails updatedBy(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.solutions.fluent.models.ApplicationInner object. + * + * @return the inner object. + */ + ApplicationInner innerModel(); + + /** The entirety of the Application definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithKind, + DefinitionStages.WithCreate { + } + /** The Application definition stages. */ + interface DefinitionStages { + /** The first stage of the Application definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Application definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Application definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithKind withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Application definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the managed application. Allowed values are MarketPlace and + * ServiceCatalog.. + * + * @param kind The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** + * The stage of the Application definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithManagedBy, + DefinitionStages.WithSku, + DefinitionStages.WithPlan, + DefinitionStages.WithIdentity, + DefinitionStages.WithManagedResourceGroupId, + DefinitionStages.WithApplicationDefinitionId, + DefinitionStages.WithParameters, + DefinitionStages.WithJitAccessPolicy { + /** + * Executes the create request. + * + * @return the created resource. + */ + Application create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Application create(Context context); + } + /** The stage of the Application definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Application definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: ID of the resource that manages this resource.. + * + * @param managedBy ID of the resource that manages this resource. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + /** The stage of the Application definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the resource.. + * + * @param sku The SKU of the resource. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the Application definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: The plan information.. + * + * @param plan The plan information. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the Application definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the Application definition allowing to specify managedResourceGroupId. */ + interface WithManagedResourceGroupId { + /** + * Specifies the managedResourceGroupId property: The managed resource group Id.. + * + * @param managedResourceGroupId The managed resource group Id. + * @return the next definition stage. + */ + WithCreate withManagedResourceGroupId(String managedResourceGroupId); + } + /** The stage of the Application definition allowing to specify applicationDefinitionId. */ + interface WithApplicationDefinitionId { + /** + * Specifies the applicationDefinitionId property: The fully qualified path of managed application + * definition Id.. + * + * @param applicationDefinitionId The fully qualified path of managed application definition Id. + * @return the next definition stage. + */ + WithCreate withApplicationDefinitionId(String applicationDefinitionId); + } + /** The stage of the Application definition allowing to specify parameters. */ + interface WithParameters { + /** + * Specifies the parameters property: Name and value pairs that define the managed application parameters. + * It can be a JObject or a well formed JSON string.. + * + * @param parameters Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * @return the next definition stage. + */ + WithCreate withParameters(Object parameters); + } + /** The stage of the Application definition allowing to specify jitAccessPolicy. */ + interface WithJitAccessPolicy { + /** + * Specifies the jitAccessPolicy property: The managed application Jit access policy.. + * + * @param jitAccessPolicy The managed application Jit access policy. + * @return the next definition stage. + */ + WithCreate withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy); + } + } + /** + * Begins update for the Application resource. + * + * @return the stage of resource update. + */ + Application.Update update(); + + /** The template for Application update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithManagedBy, + UpdateStages.WithSku, + UpdateStages.WithPlan, + UpdateStages.WithKind, + UpdateStages.WithIdentity, + UpdateStages.WithManagedResourceGroupId, + UpdateStages.WithApplicationDefinitionId, + UpdateStages.WithParameters, + UpdateStages.WithJitAccessPolicy { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Application apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Application apply(Context context); + } + /** The Application update stages. */ + interface UpdateStages { + /** The stage of the Application update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Application update allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: ID of the resource that manages this resource.. + * + * @param managedBy ID of the resource that manages this resource. + * @return the next definition stage. + */ + Update withManagedBy(String managedBy); + } + /** The stage of the Application update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the resource.. + * + * @param sku The SKU of the resource. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the Application update allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: The plan information.. + * + * @param plan The plan information. + * @return the next definition stage. + */ + Update withPlan(PlanPatchable plan); + } + /** The stage of the Application update allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the managed application. Allowed values are MarketPlace and + * ServiceCatalog.. + * + * @param kind The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * @return the next definition stage. + */ + Update withKind(String kind); + } + /** The stage of the Application update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + /** The stage of the Application update allowing to specify managedResourceGroupId. */ + interface WithManagedResourceGroupId { + /** + * Specifies the managedResourceGroupId property: The managed resource group Id.. + * + * @param managedResourceGroupId The managed resource group Id. + * @return the next definition stage. + */ + Update withManagedResourceGroupId(String managedResourceGroupId); + } + /** The stage of the Application update allowing to specify applicationDefinitionId. */ + interface WithApplicationDefinitionId { + /** + * Specifies the applicationDefinitionId property: The fully qualified path of managed application + * definition Id.. + * + * @param applicationDefinitionId The fully qualified path of managed application definition Id. + * @return the next definition stage. + */ + Update withApplicationDefinitionId(String applicationDefinitionId); + } + /** The stage of the Application update allowing to specify parameters. */ + interface WithParameters { + /** + * Specifies the parameters property: Name and value pairs that define the managed application parameters. + * It can be a JObject or a well formed JSON string.. + * + * @param parameters Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * @return the next definition stage. + */ + Update withParameters(Object parameters); + } + /** The stage of the Application update allowing to specify jitAccessPolicy. */ + interface WithJitAccessPolicy { + /** + * Specifies the jitAccessPolicy property: The managed application Jit access policy.. + * + * @param jitAccessPolicy The managed application Jit access policy. + * @return the next definition stage. + */ + Update withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Application refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Application refresh(Context context); + + /** + * Refresh Permissions for application. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(); + + /** + * Refresh Permissions for application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(Context context); + + /** + * List allowed upgrade plans for application. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void listAllowedUpgradePlans(); + + /** + * List allowed upgrade plans for application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response listAllowedUpgradePlansWithResponse(Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifact.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifact.java new file mode 100644 index 0000000000000..2bebc5f0e93c0 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifact.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application artifact. */ +@Fluent +public final class ApplicationArtifact { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationArtifact.class); + + /* + * The managed application artifact name. + */ + @JsonProperty(value = "name", required = true) + private ApplicationArtifactName name; + + /* + * The managed application artifact blob uri. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * The managed application artifact type. + */ + @JsonProperty(value = "type", required = true) + private ApplicationArtifactType type; + + /** + * Get the name property: The managed application artifact name. + * + * @return the name value. + */ + public ApplicationArtifactName name() { + return this.name; + } + + /** + * Set the name property: The managed application artifact name. + * + * @param name the name value to set. + * @return the ApplicationArtifact object itself. + */ + public ApplicationArtifact withName(ApplicationArtifactName name) { + this.name = name; + return this; + } + + /** + * Get the uri property: The managed application artifact blob uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The managed application artifact blob uri. + * + * @param uri the uri value to set. + * @return the ApplicationArtifact object itself. + */ + public ApplicationArtifact withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the type property: The managed application artifact type. + * + * @return the type value. + */ + public ApplicationArtifactType type() { + return this.type; + } + + /** + * Set the type property: The managed application artifact type. + * + * @param type the type value to set. + * @return the ApplicationArtifact object itself. + */ + public ApplicationArtifact withType(ApplicationArtifactType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ApplicationArtifact")); + } + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property uri in model ApplicationArtifact")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ApplicationArtifact")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifactName.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifactName.java new file mode 100644 index 0000000000000..861f8107f9093 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifactName.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApplicationArtifactName. */ +public final class ApplicationArtifactName extends ExpandableStringEnum { + /** Static value NotSpecified for ApplicationArtifactName. */ + public static final ApplicationArtifactName NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value ViewDefinition for ApplicationArtifactName. */ + public static final ApplicationArtifactName VIEW_DEFINITION = fromString("ViewDefinition"); + + /** Static value Authorizations for ApplicationArtifactName. */ + public static final ApplicationArtifactName AUTHORIZATIONS = fromString("Authorizations"); + + /** Static value CustomRoleDefinition for ApplicationArtifactName. */ + public static final ApplicationArtifactName CUSTOM_ROLE_DEFINITION = fromString("CustomRoleDefinition"); + + /** + * Creates or finds a ApplicationArtifactName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationArtifactName. + */ + @JsonCreator + public static ApplicationArtifactName fromString(String name) { + return fromString(name, ApplicationArtifactName.class); + } + + /** @return known ApplicationArtifactName values. */ + public static Collection values() { + return values(ApplicationArtifactName.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifactType.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifactType.java new file mode 100644 index 0000000000000..a66af72fdf383 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationArtifactType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ApplicationArtifactType. */ +public enum ApplicationArtifactType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Template. */ + TEMPLATE("Template"), + + /** Enum value Custom. */ + CUSTOM("Custom"); + + /** The actual serialized value for a ApplicationArtifactType instance. */ + private final String value; + + ApplicationArtifactType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ApplicationArtifactType instance. + * + * @param value the serialized value to parse. + * @return the parsed ApplicationArtifactType object, or null if unable to parse. + */ + @JsonCreator + public static ApplicationArtifactType fromString(String value) { + ApplicationArtifactType[] items = ApplicationArtifactType.values(); + for (ApplicationArtifactType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationAuthorization.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationAuthorization.java new file mode 100644 index 0000000000000..840ca9a47c66b --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationAuthorization.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed application provider authorization. */ +@Fluent +public final class ApplicationAuthorization { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationAuthorization.class); + + /* + * The provider's principal identifier. This is the identity that the + * provider will use to call ARM to manage the managed application + * resources. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The provider's role definition identifier. This role will define all the + * permissions that the provider must have on the managed application's + * container resource group. This role definition cannot have permission to + * delete the resource group. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /** + * Get the principalId property: The provider's principal identifier. This is the identity that the provider will + * use to call ARM to manage the managed application resources. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The provider's principal identifier. This is the identity that the provider will + * use to call ARM to manage the managed application resources. + * + * @param principalId the principalId value to set. + * @return the ApplicationAuthorization object itself. + */ + public ApplicationAuthorization withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the roleDefinitionId property: The provider's role definition identifier. This role will define all the + * permissions that the provider must have on the managed application's container resource group. This role + * definition cannot have permission to delete the resource group. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The provider's role definition identifier. This role will define all the + * permissions that the provider must have on the managed application's container resource group. This role + * definition cannot have permission to delete the resource group. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the ApplicationAuthorization object itself. + */ + public ApplicationAuthorization withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principalId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model ApplicationAuthorization")); + } + if (roleDefinitionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property roleDefinitionId in model ApplicationAuthorization")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationBillingDetailsDefinition.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationBillingDetailsDefinition.java new file mode 100644 index 0000000000000..739deccc4f962 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationBillingDetailsDefinition.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application billing details definition. */ +@Fluent +public final class ApplicationBillingDetailsDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationBillingDetailsDefinition.class); + + /* + * The managed application resource usage Id. + */ + @JsonProperty(value = "resourceUsageId") + private String resourceUsageId; + + /** + * Get the resourceUsageId property: The managed application resource usage Id. + * + * @return the resourceUsageId value. + */ + public String resourceUsageId() { + return this.resourceUsageId; + } + + /** + * Set the resourceUsageId property: The managed application resource usage Id. + * + * @param resourceUsageId the resourceUsageId value to set. + * @return the ApplicationBillingDetailsDefinition object itself. + */ + public ApplicationBillingDetailsDefinition withResourceUsageId(String resourceUsageId) { + this.resourceUsageId = resourceUsageId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationClientDetails.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationClientDetails.java new file mode 100644 index 0000000000000..ce98e9adaad1d --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationClientDetails.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The application client details to track the entity creating/updating the managed app resource. */ +@Fluent +public final class ApplicationClientDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationClientDetails.class); + + /* + * The client Oid. + */ + @JsonProperty(value = "oid") + private String oid; + + /* + * The client Puid + */ + @JsonProperty(value = "puid") + private String puid; + + /* + * The client application Id. + */ + @JsonProperty(value = "applicationId") + private String applicationId; + + /** + * Get the oid property: The client Oid. + * + * @return the oid value. + */ + public String oid() { + return this.oid; + } + + /** + * Set the oid property: The client Oid. + * + * @param oid the oid value to set. + * @return the ApplicationClientDetails object itself. + */ + public ApplicationClientDetails withOid(String oid) { + this.oid = oid; + return this; + } + + /** + * Get the puid property: The client Puid. + * + * @return the puid value. + */ + public String puid() { + return this.puid; + } + + /** + * Set the puid property: The client Puid. + * + * @param puid the puid value to set. + * @return the ApplicationClientDetails object itself. + */ + public ApplicationClientDetails withPuid(String puid) { + this.puid = puid; + return this; + } + + /** + * Get the applicationId property: The client application Id. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: The client application Id. + * + * @param applicationId the applicationId value to set. + * @return the ApplicationClientDetails object itself. + */ + public ApplicationClientDetails withApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinition.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinition.java new file mode 100644 index 0000000000000..3b95220919398 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinition.java @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ApplicationDefinition. */ +public interface ApplicationDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the managedBy property: ID of the resource that manages this resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the sku property: The SKU of the resource. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the lockLevel property: The managed application lock level. + * + * @return the lockLevel value. + */ + ApplicationLockLevel lockLevel(); + + /** + * Gets the displayName property: The managed application definition display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the isEnabled property: A value indicating whether the package is enabled or not. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the authorizations property: The managed application provider authorizations. + * + * @return the authorizations value. + */ + List authorizations(); + + /** + * Gets the artifacts property: The collection of managed application artifacts. The portal will use the files + * specified as artifacts to construct the user experience of creating a managed application from a managed + * application definition. + * + * @return the artifacts value. + */ + List artifacts(); + + /** + * Gets the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the description property: The managed application definition description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the packageFileUri property: The managed application definition package file Uri. Use this element. + * + * @return the packageFileUri value. + */ + String packageFileUri(); + + /** + * Gets the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @return the storageAccountId value. + */ + String storageAccountId(); + + /** + * Gets the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a + * JObject or well-formed JSON string. + * + * @return the mainTemplate value. + */ + Object mainTemplate(); + + /** + * Gets the createUiDefinition property: The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + * + * @return the createUiDefinition value. + */ + Object createUiDefinition(); + + /** + * Gets the notificationPolicy property: The managed application notification policy. + * + * @return the notificationPolicy value. + */ + ApplicationNotificationPolicy notificationPolicy(); + + /** + * Gets the lockingPolicy property: The managed application locking policy. + * + * @return the lockingPolicy value. + */ + ApplicationPackageLockingPolicyDefinition lockingPolicy(); + + /** + * Gets the deploymentPolicy property: The managed application deployment policy. + * + * @return the deploymentPolicy value. + */ + ApplicationDeploymentPolicy deploymentPolicy(); + + /** + * Gets the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @return the managementPolicy value. + */ + ApplicationManagementPolicy managementPolicy(); + + /** + * Gets the policies property: The managed application provider policies. + * + * @return the policies value. + */ + List policies(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner object. + * + * @return the inner object. + */ + ApplicationDefinitionInner innerModel(); + + /** The entirety of the ApplicationDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithLockLevel, + DefinitionStages.WithCreate { + } + /** The ApplicationDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the ApplicationDefinition definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ApplicationDefinition definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ApplicationDefinition definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithLockLevel withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the ApplicationDefinition definition allowing to specify lockLevel. */ + interface WithLockLevel { + /** + * Specifies the lockLevel property: The managed application lock level.. + * + * @param lockLevel The managed application lock level. + * @return the next definition stage. + */ + WithCreate withLockLevel(ApplicationLockLevel lockLevel); + } + /** + * The stage of the ApplicationDefinition definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithManagedBy, + DefinitionStages.WithSku, + DefinitionStages.WithDisplayName, + DefinitionStages.WithIsEnabled, + DefinitionStages.WithAuthorizations, + DefinitionStages.WithArtifacts, + DefinitionStages.WithDescription, + DefinitionStages.WithPackageFileUri, + DefinitionStages.WithStorageAccountId, + DefinitionStages.WithMainTemplate, + DefinitionStages.WithCreateUiDefinition, + DefinitionStages.WithNotificationPolicy, + DefinitionStages.WithLockingPolicy, + DefinitionStages.WithDeploymentPolicy, + DefinitionStages.WithManagementPolicy, + DefinitionStages.WithPolicies { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApplicationDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApplicationDefinition create(Context context); + } + /** The stage of the ApplicationDefinition definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ApplicationDefinition definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: ID of the resource that manages this resource.. + * + * @param managedBy ID of the resource that manages this resource. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + /** The stage of the ApplicationDefinition definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the resource.. + * + * @param sku The SKU of the resource. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ApplicationDefinition definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The managed application definition display name.. + * + * @param displayName The managed application definition display name. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the ApplicationDefinition definition allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: A value indicating whether the package is enabled or not.. + * + * @param isEnabled A value indicating whether the package is enabled or not. + * @return the next definition stage. + */ + WithCreate withIsEnabled(Boolean isEnabled); + } + /** The stage of the ApplicationDefinition definition allowing to specify authorizations. */ + interface WithAuthorizations { + /** + * Specifies the authorizations property: The managed application provider authorizations.. + * + * @param authorizations The managed application provider authorizations. + * @return the next definition stage. + */ + WithCreate withAuthorizations(List authorizations); + } + /** The stage of the ApplicationDefinition definition allowing to specify artifacts. */ + interface WithArtifacts { + /** + * Specifies the artifacts property: The collection of managed application artifacts. The portal will use + * the files specified as artifacts to construct the user experience of creating a managed application from + * a managed application definition.. + * + * @param artifacts The collection of managed application artifacts. The portal will use the files specified + * as artifacts to construct the user experience of creating a managed application from a managed + * application definition. + * @return the next definition stage. + */ + WithCreate withArtifacts(List artifacts); + } + /** The stage of the ApplicationDefinition definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The managed application definition description.. + * + * @param description The managed application definition description. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the ApplicationDefinition definition allowing to specify packageFileUri. */ + interface WithPackageFileUri { + /** + * Specifies the packageFileUri property: The managed application definition package file Uri. Use this + * element. + * + * @param packageFileUri The managed application definition package file Uri. Use this element. + * @return the next definition stage. + */ + WithCreate withPackageFileUri(String packageFileUri); + } + /** The stage of the ApplicationDefinition definition allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: The storage account id for bring your own storage scenario.. + * + * @param storageAccountId The storage account id for bring your own storage scenario. + * @return the next definition stage. + */ + WithCreate withStorageAccountId(String storageAccountId); + } + /** The stage of the ApplicationDefinition definition allowing to specify mainTemplate. */ + interface WithMainTemplate { + /** + * Specifies the mainTemplate property: The inline main template json which has resources to be provisioned. + * It can be a JObject or well-formed JSON string.. + * + * @param mainTemplate The inline main template json which has resources to be provisioned. It can be a + * JObject or well-formed JSON string. + * @return the next definition stage. + */ + WithCreate withMainTemplate(Object mainTemplate); + } + /** The stage of the ApplicationDefinition definition allowing to specify createUiDefinition. */ + interface WithCreateUiDefinition { + /** + * Specifies the createUiDefinition property: The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.. + * + * @param createUiDefinition The createUiDefinition json for the backing template with + * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. + * @return the next definition stage. + */ + WithCreate withCreateUiDefinition(Object createUiDefinition); + } + /** The stage of the ApplicationDefinition definition allowing to specify notificationPolicy. */ + interface WithNotificationPolicy { + /** + * Specifies the notificationPolicy property: The managed application notification policy.. + * + * @param notificationPolicy The managed application notification policy. + * @return the next definition stage. + */ + WithCreate withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy); + } + /** The stage of the ApplicationDefinition definition allowing to specify lockingPolicy. */ + interface WithLockingPolicy { + /** + * Specifies the lockingPolicy property: The managed application locking policy.. + * + * @param lockingPolicy The managed application locking policy. + * @return the next definition stage. + */ + WithCreate withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy); + } + /** The stage of the ApplicationDefinition definition allowing to specify deploymentPolicy. */ + interface WithDeploymentPolicy { + /** + * Specifies the deploymentPolicy property: The managed application deployment policy.. + * + * @param deploymentPolicy The managed application deployment policy. + * @return the next definition stage. + */ + WithCreate withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy); + } + /** The stage of the ApplicationDefinition definition allowing to specify managementPolicy. */ + interface WithManagementPolicy { + /** + * Specifies the managementPolicy property: The managed application management policy that determines + * publisher's access to the managed resource group.. + * + * @param managementPolicy The managed application management policy that determines publisher's access to + * the managed resource group. + * @return the next definition stage. + */ + WithCreate withManagementPolicy(ApplicationManagementPolicy managementPolicy); + } + /** The stage of the ApplicationDefinition definition allowing to specify policies. */ + interface WithPolicies { + /** + * Specifies the policies property: The managed application provider policies.. + * + * @param policies The managed application provider policies. + * @return the next definition stage. + */ + WithCreate withPolicies(List policies); + } + } + /** + * Begins update for the ApplicationDefinition resource. + * + * @return the stage of resource update. + */ + ApplicationDefinition.Update update(); + + /** The template for ApplicationDefinition update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ApplicationDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ApplicationDefinition apply(Context context); + } + /** The ApplicationDefinition update stages. */ + interface UpdateStages { + /** The stage of the ApplicationDefinition update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Application definition tags. + * + * @param tags Application definition tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApplicationDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApplicationDefinition refresh(Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionArtifact.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionArtifact.java new file mode 100644 index 0000000000000..e375345e4ead9 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionArtifact.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Application definition artifact. */ +@Fluent +public final class ApplicationDefinitionArtifact { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDefinitionArtifact.class); + + /* + * The managed application definition artifact name. + */ + @JsonProperty(value = "name", required = true) + private ApplicationDefinitionArtifactName name; + + /* + * The managed application definition artifact blob uri. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * The managed application definition artifact type. + */ + @JsonProperty(value = "type", required = true) + private ApplicationArtifactType type; + + /** + * Get the name property: The managed application definition artifact name. + * + * @return the name value. + */ + public ApplicationDefinitionArtifactName name() { + return this.name; + } + + /** + * Set the name property: The managed application definition artifact name. + * + * @param name the name value to set. + * @return the ApplicationDefinitionArtifact object itself. + */ + public ApplicationDefinitionArtifact withName(ApplicationDefinitionArtifactName name) { + this.name = name; + return this; + } + + /** + * Get the uri property: The managed application definition artifact blob uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The managed application definition artifact blob uri. + * + * @param uri the uri value to set. + * @return the ApplicationDefinitionArtifact object itself. + */ + public ApplicationDefinitionArtifact withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the type property: The managed application definition artifact type. + * + * @return the type value. + */ + public ApplicationArtifactType type() { + return this.type; + } + + /** + * Set the type property: The managed application definition artifact type. + * + * @param type the type value to set. + * @return the ApplicationDefinitionArtifact object itself. + */ + public ApplicationDefinitionArtifact withType(ApplicationArtifactType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model ApplicationDefinitionArtifact")); + } + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property uri in model ApplicationDefinitionArtifact")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model ApplicationDefinitionArtifact")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionArtifactName.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionArtifactName.java new file mode 100644 index 0000000000000..2248c850c0397 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionArtifactName.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApplicationDefinitionArtifactName. */ +public final class ApplicationDefinitionArtifactName extends ExpandableStringEnum { + /** Static value NotSpecified for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value ApplicationResourceTemplate for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName APPLICATION_RESOURCE_TEMPLATE = + fromString("ApplicationResourceTemplate"); + + /** Static value CreateUiDefinition for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName CREATE_UI_DEFINITION = fromString("CreateUiDefinition"); + + /** Static value MainTemplateParameters for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName MAIN_TEMPLATE_PARAMETERS = + fromString("MainTemplateParameters"); + + /** + * Creates or finds a ApplicationDefinitionArtifactName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationDefinitionArtifactName. + */ + @JsonCreator + public static ApplicationDefinitionArtifactName fromString(String name) { + return fromString(name, ApplicationDefinitionArtifactName.class); + } + + /** @return known ApplicationDefinitionArtifactName values. */ + public static Collection values() { + return values(ApplicationDefinitionArtifactName.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionListResult.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionListResult.java new file mode 100644 index 0000000000000..dbdd182f944f3 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed application definitions. */ +@Fluent +public final class ApplicationDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDefinitionListResult.class); + + /* + * The array of managed application definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of managed application definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of managed application definitions. + * + * @param value the value value to set. + * @return the ApplicationDefinitionListResult object itself. + */ + public ApplicationDefinitionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ApplicationDefinitionListResult object itself. + */ + public ApplicationDefinitionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionPatchable.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionPatchable.java new file mode 100644 index 0000000000000..1194bc2f00e01 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitionPatchable.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Information about an application definition request. */ +@Fluent +public final class ApplicationDefinitionPatchable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDefinitionPatchable.class); + + /* + * Application definition tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Application definition tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application definition tags. + * + * @param tags the tags value to set. + * @return the ApplicationDefinitionPatchable object itself. + */ + public ApplicationDefinitionPatchable withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitions.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitions.java new file mode 100644 index 0000000000000..a7c342ffcb690 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDefinitions.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ApplicationDefinitions. */ +public interface ApplicationDefinitions { + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + ApplicationDefinition getByResourceGroup(String resourceGroupName, String applicationDefinitionName); + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context); + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String applicationDefinitionName); + + /** + * Deletes the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String applicationDefinitionName, Context context); + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the managed application definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the application definitions within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + PagedIterable list(); + + /** + * Gets all the application definitions within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the application definitions within a subscription. + */ + PagedIterable list(Context context); + + /** + * Gets the managed application definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + ApplicationDefinition getById(String id); + + /** + * Gets the managed application definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the managed application definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the managed application definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ApplicationDefinition resource. + * + * @param name resource name. + * @return the first stage of the new ApplicationDefinition definition. + */ + ApplicationDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDeploymentPolicy.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDeploymentPolicy.java new file mode 100644 index 0000000000000..b4a0945aa364c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationDeploymentPolicy.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application deployment policy. */ +@Fluent +public final class ApplicationDeploymentPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationDeploymentPolicy.class); + + /* + * The managed application deployment mode. + */ + @JsonProperty(value = "deploymentMode", required = true) + private DeploymentMode deploymentMode; + + /** + * Get the deploymentMode property: The managed application deployment mode. + * + * @return the deploymentMode value. + */ + public DeploymentMode deploymentMode() { + return this.deploymentMode; + } + + /** + * Set the deploymentMode property: The managed application deployment mode. + * + * @param deploymentMode the deploymentMode value to set. + * @return the ApplicationDeploymentPolicy object itself. + */ + public ApplicationDeploymentPolicy withDeploymentMode(DeploymentMode deploymentMode) { + this.deploymentMode = deploymentMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deploymentMode() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property deploymentMode in model ApplicationDeploymentPolicy")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationJitAccessPolicy.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationJitAccessPolicy.java new file mode 100644 index 0000000000000..2b9a1896d87ca --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationJitAccessPolicy.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Managed application Jit access policy. */ +@Fluent +public final class ApplicationJitAccessPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationJitAccessPolicy.class); + + /* + * Whether the JIT access is enabled. + */ + @JsonProperty(value = "jitAccessEnabled", required = true) + private boolean jitAccessEnabled; + + /* + * JIT approval mode. + */ + @JsonProperty(value = "jitApprovalMode") + private JitApprovalMode jitApprovalMode; + + /* + * The JIT approvers + */ + @JsonProperty(value = "jitApprovers") + private List jitApprovers; + + /* + * The maximum duration JIT access is granted. This is an ISO8601 time + * period value. + */ + @JsonProperty(value = "maximumJitAccessDuration") + private String maximumJitAccessDuration; + + /** + * Get the jitAccessEnabled property: Whether the JIT access is enabled. + * + * @return the jitAccessEnabled value. + */ + public boolean jitAccessEnabled() { + return this.jitAccessEnabled; + } + + /** + * Set the jitAccessEnabled property: Whether the JIT access is enabled. + * + * @param jitAccessEnabled the jitAccessEnabled value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withJitAccessEnabled(boolean jitAccessEnabled) { + this.jitAccessEnabled = jitAccessEnabled; + return this; + } + + /** + * Get the jitApprovalMode property: JIT approval mode. + * + * @return the jitApprovalMode value. + */ + public JitApprovalMode jitApprovalMode() { + return this.jitApprovalMode; + } + + /** + * Set the jitApprovalMode property: JIT approval mode. + * + * @param jitApprovalMode the jitApprovalMode value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withJitApprovalMode(JitApprovalMode jitApprovalMode) { + this.jitApprovalMode = jitApprovalMode; + return this; + } + + /** + * Get the jitApprovers property: The JIT approvers. + * + * @return the jitApprovers value. + */ + public List jitApprovers() { + return this.jitApprovers; + } + + /** + * Set the jitApprovers property: The JIT approvers. + * + * @param jitApprovers the jitApprovers value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withJitApprovers(List jitApprovers) { + this.jitApprovers = jitApprovers; + return this; + } + + /** + * Get the maximumJitAccessDuration property: The maximum duration JIT access is granted. This is an ISO8601 time + * period value. + * + * @return the maximumJitAccessDuration value. + */ + public String maximumJitAccessDuration() { + return this.maximumJitAccessDuration; + } + + /** + * Set the maximumJitAccessDuration property: The maximum duration JIT access is granted. This is an ISO8601 time + * period value. + * + * @param maximumJitAccessDuration the maximumJitAccessDuration value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withMaximumJitAccessDuration(String maximumJitAccessDuration) { + this.maximumJitAccessDuration = maximumJitAccessDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (jitApprovers() != null) { + jitApprovers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationListResult.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationListResult.java new file mode 100644 index 0000000000000..20b2ad3a97edb --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed applications. */ +@Fluent +public final class ApplicationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationListResult.class); + + /* + * The array of managed applications. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of managed applications. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of managed applications. + * + * @param value the value value to set. + * @return the ApplicationListResult object itself. + */ + public ApplicationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ApplicationListResult object itself. + */ + public ApplicationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationLockLevel.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationLockLevel.java new file mode 100644 index 0000000000000..b6216c7db03a4 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationLockLevel.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ApplicationLockLevel. */ +public enum ApplicationLockLevel { + /** Enum value CanNotDelete. */ + CAN_NOT_DELETE("CanNotDelete"), + + /** Enum value ReadOnly. */ + READ_ONLY("ReadOnly"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ApplicationLockLevel instance. */ + private final String value; + + ApplicationLockLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ApplicationLockLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed ApplicationLockLevel object, or null if unable to parse. + */ + @JsonCreator + public static ApplicationLockLevel fromString(String value) { + ApplicationLockLevel[] items = ApplicationLockLevel.values(); + for (ApplicationLockLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationManagementMode.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationManagementMode.java new file mode 100644 index 0000000000000..6e2314056f598 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationManagementMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApplicationManagementMode. */ +public final class ApplicationManagementMode extends ExpandableStringEnum { + /** Static value NotSpecified for ApplicationManagementMode. */ + public static final ApplicationManagementMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Unmanaged for ApplicationManagementMode. */ + public static final ApplicationManagementMode UNMANAGED = fromString("Unmanaged"); + + /** Static value Managed for ApplicationManagementMode. */ + public static final ApplicationManagementMode MANAGED = fromString("Managed"); + + /** + * Creates or finds a ApplicationManagementMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationManagementMode. + */ + @JsonCreator + public static ApplicationManagementMode fromString(String name) { + return fromString(name, ApplicationManagementMode.class); + } + + /** @return known ApplicationManagementMode values. */ + public static Collection values() { + return values(ApplicationManagementMode.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationManagementPolicy.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationManagementPolicy.java new file mode 100644 index 0000000000000..9f11ee0f00caa --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationManagementPolicy.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application management policy. */ +@Fluent +public final class ApplicationManagementPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationManagementPolicy.class); + + /* + * The managed application management mode. + */ + @JsonProperty(value = "mode") + private ApplicationManagementMode mode; + + /** + * Get the mode property: The managed application management mode. + * + * @return the mode value. + */ + public ApplicationManagementMode mode() { + return this.mode; + } + + /** + * Set the mode property: The managed application management mode. + * + * @param mode the mode value to set. + * @return the ApplicationManagementPolicy object itself. + */ + public ApplicationManagementPolicy withMode(ApplicationManagementMode mode) { + this.mode = mode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationNotificationEndpoint.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationNotificationEndpoint.java new file mode 100644 index 0000000000000..eb93d43980c5c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationNotificationEndpoint.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application notification endpoint. */ +@Fluent +public final class ApplicationNotificationEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationNotificationEndpoint.class); + + /* + * The managed application notification endpoint uri. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /** + * Get the uri property: The managed application notification endpoint uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The managed application notification endpoint uri. + * + * @param uri the uri value to set. + * @return the ApplicationNotificationEndpoint object itself. + */ + public ApplicationNotificationEndpoint withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property uri in model ApplicationNotificationEndpoint")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationNotificationPolicy.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationNotificationPolicy.java new file mode 100644 index 0000000000000..24acfcaff19c0 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationNotificationPolicy.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Managed application notification policy. */ +@Fluent +public final class ApplicationNotificationPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationNotificationPolicy.class); + + /* + * The managed application notification endpoint. + */ + @JsonProperty(value = "notificationEndpoints", required = true) + private List notificationEndpoints; + + /** + * Get the notificationEndpoints property: The managed application notification endpoint. + * + * @return the notificationEndpoints value. + */ + public List notificationEndpoints() { + return this.notificationEndpoints; + } + + /** + * Set the notificationEndpoints property: The managed application notification endpoint. + * + * @param notificationEndpoints the notificationEndpoints value to set. + * @return the ApplicationNotificationPolicy object itself. + */ + public ApplicationNotificationPolicy withNotificationEndpoints( + List notificationEndpoints) { + this.notificationEndpoints = notificationEndpoints; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (notificationEndpoints() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property notificationEndpoints in model ApplicationNotificationPolicy")); + } else { + notificationEndpoints().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageContact.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageContact.java new file mode 100644 index 0000000000000..7b1f484af461f --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageContact.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The application package contact information. */ +@Fluent +public final class ApplicationPackageContact { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPackageContact.class); + + /* + * The contact name. + */ + @JsonProperty(value = "contactName") + private String contactName; + + /* + * The contact email. + */ + @JsonProperty(value = "email", required = true) + private String email; + + /* + * The contact phone number. + */ + @JsonProperty(value = "phone", required = true) + private String phone; + + /** + * Get the contactName property: The contact name. + * + * @return the contactName value. + */ + public String contactName() { + return this.contactName; + } + + /** + * Set the contactName property: The contact name. + * + * @param contactName the contactName value to set. + * @return the ApplicationPackageContact object itself. + */ + public ApplicationPackageContact withContactName(String contactName) { + this.contactName = contactName; + return this; + } + + /** + * Get the email property: The contact email. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: The contact email. + * + * @param email the email value to set. + * @return the ApplicationPackageContact object itself. + */ + public ApplicationPackageContact withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the phone property: The contact phone number. + * + * @return the phone value. + */ + public String phone() { + return this.phone; + } + + /** + * Set the phone property: The contact phone number. + * + * @param phone the phone value to set. + * @return the ApplicationPackageContact object itself. + */ + public ApplicationPackageContact withPhone(String phone) { + this.phone = phone; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (email() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property email in model ApplicationPackageContact")); + } + if (phone() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property phone in model ApplicationPackageContact")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageLockingPolicyDefinition.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageLockingPolicyDefinition.java new file mode 100644 index 0000000000000..631576ed12689 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageLockingPolicyDefinition.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Managed application locking policy. */ +@Fluent +public final class ApplicationPackageLockingPolicyDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPackageLockingPolicyDefinition.class); + + /* + * The deny assignment excluded actions. + */ + @JsonProperty(value = "allowedActions") + private List allowedActions; + + /* + * The deny assignment excluded data actions. + */ + @JsonProperty(value = "allowedDataActions") + private List allowedDataActions; + + /** + * Get the allowedActions property: The deny assignment excluded actions. + * + * @return the allowedActions value. + */ + public List allowedActions() { + return this.allowedActions; + } + + /** + * Set the allowedActions property: The deny assignment excluded actions. + * + * @param allowedActions the allowedActions value to set. + * @return the ApplicationPackageLockingPolicyDefinition object itself. + */ + public ApplicationPackageLockingPolicyDefinition withAllowedActions(List allowedActions) { + this.allowedActions = allowedActions; + return this; + } + + /** + * Get the allowedDataActions property: The deny assignment excluded data actions. + * + * @return the allowedDataActions value. + */ + public List allowedDataActions() { + return this.allowedDataActions; + } + + /** + * Set the allowedDataActions property: The deny assignment excluded data actions. + * + * @param allowedDataActions the allowedDataActions value to set. + * @return the ApplicationPackageLockingPolicyDefinition object itself. + */ + public ApplicationPackageLockingPolicyDefinition withAllowedDataActions(List allowedDataActions) { + this.allowedDataActions = allowedDataActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageSupportUrls.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageSupportUrls.java new file mode 100644 index 0000000000000..d9e5f4fbbb788 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPackageSupportUrls.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The appliance package support URLs. */ +@Fluent +public final class ApplicationPackageSupportUrls { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPackageSupportUrls.class); + + /* + * The public azure support URL. + */ + @JsonProperty(value = "publicAzure") + private String publicAzure; + + /* + * The government cloud support URL. + */ + @JsonProperty(value = "governmentCloud") + private String governmentCloud; + + /** + * Get the publicAzure property: The public azure support URL. + * + * @return the publicAzure value. + */ + public String publicAzure() { + return this.publicAzure; + } + + /** + * Set the publicAzure property: The public azure support URL. + * + * @param publicAzure the publicAzure value to set. + * @return the ApplicationPackageSupportUrls object itself. + */ + public ApplicationPackageSupportUrls withPublicAzure(String publicAzure) { + this.publicAzure = publicAzure; + return this; + } + + /** + * Get the governmentCloud property: The government cloud support URL. + * + * @return the governmentCloud value. + */ + public String governmentCloud() { + return this.governmentCloud; + } + + /** + * Set the governmentCloud property: The government cloud support URL. + * + * @param governmentCloud the governmentCloud value to set. + * @return the ApplicationPackageSupportUrls object itself. + */ + public ApplicationPackageSupportUrls withGovernmentCloud(String governmentCloud) { + this.governmentCloud = governmentCloud; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPatchable.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPatchable.java new file mode 100644 index 0000000000000..29165026126f6 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPatchable.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.models.ApplicationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Information about managed application. */ +@Fluent +public final class ApplicationPatchable extends GenericResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPatchable.class); + + /* + * The managed application properties. + */ + @JsonProperty(value = "properties") + private ApplicationProperties innerProperties; + + /* + * The plan information. + */ + @JsonProperty(value = "plan") + private PlanPatchable plan; + + /* + * The kind of the managed application. Allowed values are MarketPlace and + * ServiceCatalog. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the innerProperties property: The managed application properties. + * + * @return the innerProperties value. + */ + private ApplicationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the plan property: The plan information. + * + * @return the plan value. + */ + public PlanPatchable plan() { + return this.plan; + } + + /** + * Set the plan property: The plan information. + * + * @param plan the plan value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withPlan(PlanPatchable plan) { + this.plan = plan; + return this; + } + + /** + * Get the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @param kind the kind value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchable withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchable withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchable withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchable withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the managedResourceGroupId property: The managed resource group Id. + * + * @return the managedResourceGroupId value. + */ + public String managedResourceGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupId(); + } + + /** + * Set the managedResourceGroupId property: The managed resource group Id. + * + * @param managedResourceGroupId the managedResourceGroupId value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withManagedResourceGroupId(String managedResourceGroupId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withManagedResourceGroupId(managedResourceGroupId); + return this; + } + + /** + * Get the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @return the applicationDefinitionId value. + */ + public String applicationDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().applicationDefinitionId(); + } + + /** + * Set the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @param applicationDefinitionId the applicationDefinitionId value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withApplicationDefinitionId(String applicationDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withApplicationDefinitionId(applicationDefinitionId); + return this; + } + + /** + * Get the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @return the parameters value. + */ + public Object parameters() { + return this.innerProperties() == null ? null : this.innerProperties().parameters(); + } + + /** + * Set the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @param parameters the parameters value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withParameters(Object parameters) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withParameters(parameters); + return this; + } + + /** + * Get the outputs property: Name and value pairs that define the managed application outputs. + * + * @return the outputs value. + */ + public Object outputs() { + return this.innerProperties() == null ? null : this.innerProperties().outputs(); + } + + /** + * Get the provisioningState property: The managed application provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerProperties() == null ? null : this.innerProperties().billingDetails(); + } + + /** + * Get the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().jitAccessPolicy(); + } + + /** + * Set the jitAccessPolicy property: The managed application Jit access policy. + * + * @param jitAccessPolicy the jitAccessPolicy value to set. + * @return the ApplicationPatchable object itself. + */ + public ApplicationPatchable withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withJitAccessPolicy(jitAccessPolicy); + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().publisherTenantId(); + } + + /** + * Get the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.innerProperties() == null ? null : this.innerProperties().authorizations(); + } + + /** + * Get the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + public ApplicationManagementMode managementMode() { + return this.innerProperties() == null ? null : this.innerProperties().managementMode(); + } + + /** + * Get the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + public ApplicationPackageContact customerSupport() { + return this.innerProperties() == null ? null : this.innerProperties().customerSupport(); + } + + /** + * Get the supportUrls property: The read-only support URLs property that is retrieved from the application package. + * + * @return the supportUrls value. + */ + public ApplicationPackageSupportUrls supportUrls() { + return this.innerProperties() == null ? null : this.innerProperties().supportUrls(); + } + + /** + * Get the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.innerProperties() == null ? null : this.innerProperties().artifacts(); + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().updatedBy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + if (plan() != null) { + plan().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPolicy.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPolicy.java new file mode 100644 index 0000000000000..0ffd63e3de5ca --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ApplicationPolicy.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application policy. */ +@Fluent +public final class ApplicationPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPolicy.class); + + /* + * The policy name + */ + @JsonProperty(value = "name") + private String name; + + /* + * The policy definition Id. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /* + * The policy parameters. + */ + @JsonProperty(value = "parameters") + private String parameters; + + /** + * Get the name property: The policy name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The policy name. + * + * @param name the name value to set. + * @return the ApplicationPolicy object itself. + */ + public ApplicationPolicy withName(String name) { + this.name = name; + return this; + } + + /** + * Get the policyDefinitionId property: The policy definition Id. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the policyDefinitionId property: The policy definition Id. + * + * @param policyDefinitionId the policyDefinitionId value to set. + * @return the ApplicationPolicy object itself. + */ + public ApplicationPolicy withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the parameters property: The policy parameters. + * + * @return the parameters value. + */ + public String parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The policy parameters. + * + * @param parameters the parameters value to set. + * @return the ApplicationPolicy object itself. + */ + public ApplicationPolicy withParameters(String parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Applications.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Applications.java new file mode 100644 index 0000000000000..d13530a57ae2a --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Applications.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Applications. */ +public interface Applications { + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + Application getByResourceGroup(String resourceGroupName, String applicationName); + + /** + * Gets the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationName, Context context); + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String applicationName); + + /** + * Deletes the managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String applicationName, Context context); + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the applications within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + PagedIterable list(); + + /** + * Gets all the applications within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the applications within a subscription. + */ + PagedIterable list(Context context); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(String resourceGroupName, String applicationName); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(String resourceGroupName, String applicationName, Context context); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void listAllowedUpgradePlans(String resourceGroupName, String applicationName); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context); + + /** + * Gets the managed application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + Application getById(String id); + + /** + * Gets the managed application. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the managed application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the managed application. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Application resource. + * + * @param name resource name. + * @return the first stage of the new Application definition. + */ + Application.DefinitionStages.Blank define(String name); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/DeploymentMode.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/DeploymentMode.java new file mode 100644 index 0000000000000..6a84d7951286e --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/DeploymentMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DeploymentMode. */ +public final class DeploymentMode extends ExpandableStringEnum { + /** Static value NotSpecified for DeploymentMode. */ + public static final DeploymentMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Incremental for DeploymentMode. */ + public static final DeploymentMode INCREMENTAL = fromString("Incremental"); + + /** Static value Complete for DeploymentMode. */ + public static final DeploymentMode COMPLETE = fromString("Complete"); + + /** + * Creates or finds a DeploymentMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentMode. + */ + @JsonCreator + public static DeploymentMode fromString(String name) { + return fromString(name, DeploymentMode.class); + } + + /** @return known DeploymentMode values. */ + public static Collection values() { + return values(DeploymentMode.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/GenericResource.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/GenericResource.java new file mode 100644 index 0000000000000..fa251f5ef5d35 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/GenericResource.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Resource information. */ +@Fluent +public class GenericResource extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenericResource.class); + + /* + * 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; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the managedBy property: ID of the resource that manages this resource. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the managedBy property: ID of the resource that manages this resource. + * + * @param managedBy the managedBy value to set. + * @return the GenericResource object itself. + */ + public GenericResource withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the sku property: The SKU of the resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the resource. + * + * @param sku the sku value to set. + * @return the GenericResource object itself. + */ + public GenericResource withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public GenericResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GenericResource withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Identity.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Identity.java new file mode 100644 index 0000000000000..68d7121c70ed7 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Identity.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * 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. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with the resource. The user + * identity dictionary key references will be resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be 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 userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApprovalMode.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApprovalMode.java new file mode 100644 index 0000000000000..ce06fc6ec2772 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApprovalMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JitApprovalMode. */ +public final class JitApprovalMode extends ExpandableStringEnum { + /** Static value NotSpecified for JitApprovalMode. */ + public static final JitApprovalMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value AutoApprove for JitApprovalMode. */ + public static final JitApprovalMode AUTO_APPROVE = fromString("AutoApprove"); + + /** Static value ManualApprove for JitApprovalMode. */ + public static final JitApprovalMode MANUAL_APPROVE = fromString("ManualApprove"); + + /** + * Creates or finds a JitApprovalMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitApprovalMode. + */ + @JsonCreator + public static JitApprovalMode fromString(String name) { + return fromString(name, JitApprovalMode.class); + } + + /** @return known JitApprovalMode values. */ + public static Collection values() { + return values(JitApprovalMode.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApproverDefinition.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApproverDefinition.java new file mode 100644 index 0000000000000..22ea6d2d2ba62 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApproverDefinition.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** JIT approver definition. */ +@Fluent +public final class JitApproverDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitApproverDefinition.class); + + /* + * The approver service principal Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The approver type. + */ + @JsonProperty(value = "type") + private JitApproverType type; + + /* + * The approver display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the id property: The approver service principal Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The approver service principal Id. + * + * @param id the id value to set. + * @return the JitApproverDefinition object itself. + */ + public JitApproverDefinition withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: The approver type. + * + * @return the type value. + */ + public JitApproverType type() { + return this.type; + } + + /** + * Set the type property: The approver type. + * + * @param type the type value to set. + * @return the JitApproverDefinition object itself. + */ + public JitApproverDefinition withType(JitApproverType type) { + this.type = type; + return this; + } + + /** + * Get the displayName property: The approver display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The approver display name. + * + * @param displayName the displayName value to set. + * @return the JitApproverDefinition object itself. + */ + public JitApproverDefinition withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model JitApproverDefinition")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApproverType.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApproverType.java new file mode 100644 index 0000000000000..558fb8e553df1 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitApproverType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JitApproverType. */ +public final class JitApproverType extends ExpandableStringEnum { + /** Static value user for JitApproverType. */ + public static final JitApproverType USER = fromString("user"); + + /** Static value group for JitApproverType. */ + public static final JitApproverType GROUP = fromString("group"); + + /** + * Creates or finds a JitApproverType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitApproverType. + */ + @JsonCreator + public static JitApproverType fromString(String name) { + return fromString(name, JitApproverType.class); + } + + /** @return known JitApproverType values. */ + public static Collection values() { + return values(JitApproverType.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitAuthorizationPolicies.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitAuthorizationPolicies.java new file mode 100644 index 0000000000000..34022cf7644cf --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitAuthorizationPolicies.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JIT authorization policies. */ +@Fluent +public final class JitAuthorizationPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitAuthorizationPolicies.class); + + /* + * The the principal id that will be granted JIT access. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The role definition id that will be granted to the Principal. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /** + * Get the principalId property: The the principal id that will be granted JIT access. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The the principal id that will be granted JIT access. + * + * @param principalId the principalId value to set. + * @return the JitAuthorizationPolicies object itself. + */ + public JitAuthorizationPolicies withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the roleDefinitionId property: The role definition id that will be granted to the Principal. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The role definition id that will be granted to the Principal. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the JitAuthorizationPolicies object itself. + */ + public JitAuthorizationPolicies withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principalId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model JitAuthorizationPolicies")); + } + if (roleDefinitionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property roleDefinitionId in model JitAuthorizationPolicies")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestDefinition.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestDefinition.java new file mode 100644 index 0000000000000..9072f78eaeee5 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestDefinition.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of JitRequestDefinition. */ +public interface JitRequestDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the applicationResourceId property: The parent application id. + * + * @return the applicationResourceId value. + */ + String applicationResourceId(); + + /** + * Gets the publisherTenantId property: The publisher tenant id. + * + * @return the publisherTenantId value. + */ + String publisherTenantId(); + + /** + * Gets the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @return the jitAuthorizationPolicies value. + */ + List jitAuthorizationPolicies(); + + /** + * Gets the jitSchedulingPolicy property: The JIT request properties. + * + * @return the jitSchedulingPolicy value. + */ + JitSchedulingPolicy jitSchedulingPolicy(); + + /** + * Gets the provisioningState property: The JIT request provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the jitRequestState property: The JIT request state. + * + * @return the jitRequestState value. + */ + JitRequestState jitRequestState(); + + /** + * Gets the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + ApplicationClientDetails createdBy(); + + /** + * Gets the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + ApplicationClientDetails updatedBy(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionInner object. + * + * @return the inner object. + */ + JitRequestDefinitionInner innerModel(); + + /** The entirety of the JitRequestDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The JitRequestDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the JitRequestDefinition definition. */ + interface Blank extends WithLocation { + } + /** The stage of the JitRequestDefinition definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the JitRequestDefinition definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the JitRequestDefinition definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithApplicationResourceId, + DefinitionStages.WithJitAuthorizationPolicies, + DefinitionStages.WithJitSchedulingPolicy { + /** + * Executes the create request. + * + * @return the created resource. + */ + JitRequestDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JitRequestDefinition create(Context context); + } + /** The stage of the JitRequestDefinition definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the JitRequestDefinition definition allowing to specify applicationResourceId. */ + interface WithApplicationResourceId { + /** + * Specifies the applicationResourceId property: The parent application id.. + * + * @param applicationResourceId The parent application id. + * @return the next definition stage. + */ + WithCreate withApplicationResourceId(String applicationResourceId); + } + /** The stage of the JitRequestDefinition definition allowing to specify jitAuthorizationPolicies. */ + interface WithJitAuthorizationPolicies { + /** + * Specifies the jitAuthorizationPolicies property: The JIT authorization policies.. + * + * @param jitAuthorizationPolicies The JIT authorization policies. + * @return the next definition stage. + */ + WithCreate withJitAuthorizationPolicies(List jitAuthorizationPolicies); + } + /** The stage of the JitRequestDefinition definition allowing to specify jitSchedulingPolicy. */ + interface WithJitSchedulingPolicy { + /** + * Specifies the jitSchedulingPolicy property: The JIT request properties.. + * + * @param jitSchedulingPolicy The JIT request properties. + * @return the next definition stage. + */ + WithCreate withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy); + } + } + /** + * Begins update for the JitRequestDefinition resource. + * + * @return the stage of resource update. + */ + JitRequestDefinition.Update update(); + + /** The template for JitRequestDefinition update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JitRequestDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JitRequestDefinition apply(Context context); + } + /** The JitRequestDefinition update stages. */ + interface UpdateStages { + /** The stage of the JitRequestDefinition update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Jit request tags. + * + * @param tags Jit request tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JitRequestDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JitRequestDefinition refresh(Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestDefinitionListResult.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestDefinitionListResult.java new file mode 100644 index 0000000000000..cb33cbc8e886c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestDefinitionListResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionListResultInner; +import java.util.List; + +/** An immutable client-side representation of JitRequestDefinitionListResult. */ +public interface JitRequestDefinitionListResult { + /** + * Gets the value property: The array of Jit request definition. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.solutions.fluent.models.JitRequestDefinitionListResultInner object. + * + * @return the inner object. + */ + JitRequestDefinitionListResultInner innerModel(); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestPatchable.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestPatchable.java new file mode 100644 index 0000000000000..7806b764b4898 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestPatchable.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Information about JIT request. */ +@Fluent +public final class JitRequestPatchable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitRequestPatchable.class); + + /* + * Jit request tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Jit request tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Jit request tags. + * + * @param tags the tags value to set. + * @return the JitRequestPatchable object itself. + */ + public JitRequestPatchable withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestState.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestState.java new file mode 100644 index 0000000000000..ac2116e00f034 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequestState.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JitRequestState. */ +public final class JitRequestState extends ExpandableStringEnum { + /** Static value NotSpecified for JitRequestState. */ + public static final JitRequestState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Pending for JitRequestState. */ + public static final JitRequestState PENDING = fromString("Pending"); + + /** Static value Approved for JitRequestState. */ + public static final JitRequestState APPROVED = fromString("Approved"); + + /** Static value Denied for JitRequestState. */ + public static final JitRequestState DENIED = fromString("Denied"); + + /** Static value Failed for JitRequestState. */ + public static final JitRequestState FAILED = fromString("Failed"); + + /** Static value Canceled for JitRequestState. */ + public static final JitRequestState CANCELED = fromString("Canceled"); + + /** Static value Expired for JitRequestState. */ + public static final JitRequestState EXPIRED = fromString("Expired"); + + /** Static value Timeout for JitRequestState. */ + public static final JitRequestState TIMEOUT = fromString("Timeout"); + + /** + * Creates or finds a JitRequestState from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitRequestState. + */ + @JsonCreator + public static JitRequestState fromString(String name) { + return fromString(name, JitRequestState.class); + } + + /** @return known JitRequestState values. */ + public static Collection values() { + return values(JitRequestState.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequests.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequests.java new file mode 100644 index 0000000000000..e457bc4efaf1c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitRequests.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JitRequests. */ +public interface JitRequests { + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + JitRequestDefinition getByResourceGroup(String resourceGroupName, String jitRequestName); + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String jitRequestName); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String jitRequestName, Context context); + + /** + * Retrieves all JIT requests within the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + JitRequestDefinitionListResult listBySubscription(); + + /** + * Retrieves all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + Response listBySubscriptionWithResponse(Context context); + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + JitRequestDefinitionListResult listByResourceGroup(String resourceGroupName); + + /** + * Retrieves all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + Response listByResourceGroupWithResponse(String resourceGroupName, Context context); + + /** + * Gets the JIT request. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + JitRequestDefinition getById(String id); + + /** + * Gets the JIT request. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the JIT request. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the JIT request. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JitRequestDefinition resource. + * + * @param name resource name. + * @return the first stage of the new JitRequestDefinition definition. + */ + JitRequestDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitSchedulingPolicy.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitSchedulingPolicy.java new file mode 100644 index 0000000000000..245c2f832b7d3 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitSchedulingPolicy.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; + +/** The JIT scheduling policies. */ +@Fluent +public final class JitSchedulingPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JitSchedulingPolicy.class); + + /* + * The type of JIT schedule. + */ + @JsonProperty(value = "type", required = true) + private JitSchedulingType type; + + /* + * The required duration of the JIT request. + */ + @JsonProperty(value = "duration", required = true) + private Duration duration; + + /* + * The start time of the request. + */ + @JsonProperty(value = "startTime", required = true) + private OffsetDateTime startTime; + + /** + * Get the type property: The type of JIT schedule. + * + * @return the type value. + */ + public JitSchedulingType type() { + return this.type; + } + + /** + * Set the type property: The type of JIT schedule. + * + * @param type the type value to set. + * @return the JitSchedulingPolicy object itself. + */ + public JitSchedulingPolicy withType(JitSchedulingType type) { + this.type = type; + return this; + } + + /** + * Get the duration property: The required duration of the JIT request. + * + * @return the duration value. + */ + public Duration duration() { + return this.duration; + } + + /** + * Set the duration property: The required duration of the JIT request. + * + * @param duration the duration value to set. + * @return the JitSchedulingPolicy object itself. + */ + public JitSchedulingPolicy withDuration(Duration duration) { + this.duration = duration; + return this; + } + + /** + * Get the startTime property: The start time of the request. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the request. + * + * @param startTime the startTime value to set. + * @return the JitSchedulingPolicy object itself. + */ + public JitSchedulingPolicy withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model JitSchedulingPolicy")); + } + if (duration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property duration in model JitSchedulingPolicy")); + } + if (startTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property startTime in model JitSchedulingPolicy")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitSchedulingType.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitSchedulingType.java new file mode 100644 index 0000000000000..5be7184716d70 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/JitSchedulingType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for JitSchedulingType. */ +public final class JitSchedulingType extends ExpandableStringEnum { + /** Static value NotSpecified for JitSchedulingType. */ + public static final JitSchedulingType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Once for JitSchedulingType. */ + public static final JitSchedulingType ONCE = fromString("Once"); + + /** Static value Recurring for JitSchedulingType. */ + public static final JitSchedulingType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a JitSchedulingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitSchedulingType. + */ + @JsonCreator + public static JitSchedulingType fromString(String name) { + return fromString(name, JitSchedulingType.class); + } + + /** @return known JitSchedulingType values. */ + public static Collection values() { + return values(JitSchedulingType.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Operation.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Operation.java new file mode 100644 index 0000000000000..284fa4c9fbba3 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.resourcemanager.solutions.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.solutions.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/OperationDisplay.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/OperationDisplay.java new file mode 100644 index 0000000000000..dc4f7cfa46006 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/OperationDisplay.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * The localized friendly form of the resource provider name, e.g. + * "Microsoft Monitoring Insights" or "Microsoft Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this + * operation. E.g. "Virtual Machines" or "Job Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for + * dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual + * Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for + * tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/OperationListResult.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/OperationListResult.java new file mode 100644 index 0000000000000..28ff2777d441e --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.solutions.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Origin.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Origin.java new file mode 100644 index 0000000000000..2238cece4ce17 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Origin.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Origin. */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** @return known Origin values. */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Plan.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Plan.java new file mode 100644 index 0000000000000..57b9ccb3b8524 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Plan.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Plan for the managed application. */ +@Fluent +public final class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * The plan name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The product code. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /* + * The promotion code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /* + * The plan's version. + */ + @JsonProperty(value = "version", required = true) + private String version; + + /** + * Get the name property: The plan name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The plan name. + * + * @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 property: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: 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 product property: The product code. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The product code. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: The promotion code. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: 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 version property: The plan's version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Plan")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property publisher in model Plan")); + } + if (product() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property product in model Plan")); + } + if (version() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property version in model Plan")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/PlanPatchable.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/PlanPatchable.java new file mode 100644 index 0000000000000..82969bdd64216 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/PlanPatchable.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Plan for the managed application. */ +@Fluent +public final class PlanPatchable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PlanPatchable.class); + + /* + * The plan name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * The product code. + */ + @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 name property: The plan name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The plan name. + * + * @param name the name value to set. + * @return the PlanPatchable object itself. + */ + public PlanPatchable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher ID. + * + * @param publisher the publisher value to set. + * @return the PlanPatchable object itself. + */ + public PlanPatchable withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The product code. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The product code. + * + * @param product the product value to set. + * @return the PlanPatchable object itself. + */ + public PlanPatchable withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: The promotion code. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: The promotion code. + * + * @param promotionCode the promotionCode value to set. + * @return the PlanPatchable object itself. + */ + public PlanPatchable withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The plan's version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The plan's version. + * + * @param version the version value to set. + * @return the PlanPatchable object itself. + */ + public PlanPatchable withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ProvisioningState.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ProvisioningState.java new file mode 100644 index 0000000000000..999a2d1b10b92 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ProvisioningState.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Running for ProvisioningState. */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ResourceIdentityType.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..5c0d881c4eb58 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ResourceIdentityType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +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 final 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/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ResourceProviders.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ResourceProviders.java new file mode 100644 index 0000000000000..4ce1238fcdd3c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/ResourceProviders.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + PagedIterable listOperations(); + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + PagedIterable listOperations(Context context); +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Sku.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Sku.java new file mode 100644 index 0000000000000..00a3385eb2e09 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/Sku.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** SKU for the resource. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The SKU name. + */ + @JsonProperty(value = "name", required = true) + 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 name property: The SKU name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: 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 tier property: The SKU tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: 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 size property: The SKU size. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: 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 family property: The SKU family. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: 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 model property: The SKU model. + * + * @return the model value. + */ + public String model() { + return this.model; + } + + /** + * Set the model property: 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 capacity property: The SKU capacity. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + } + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/UserAssignedResourceIdentity.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/UserAssignedResourceIdentity.java new file mode 100644 index 0000000000000..dbd1c1dcc573e --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/UserAssignedResourceIdentity.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the user assigned identity that is contained within the UserAssignedIdentities dictionary on + * ResourceIdentity. + */ +@Immutable +public class UserAssignedResourceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserAssignedResourceIdentity.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of user assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id of user assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/package-info.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/package-info.java new file mode 100644 index 0000000000000..c1254083d6933 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ManagedApplicationManagementClient. Managed Application Client. */ +package com.azure.resourcemanager.solutions.models; diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/package-info.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/package-info.java new file mode 100644 index 0000000000000..5ce3ece781853 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/com/azure/resourcemanager/solutions/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ManagedApplicationManagementClient. Managed Application Client. */ +package com.azure.resourcemanager.solutions; diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/main/java/module-info.java b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/module-info.java new file mode 100644 index 0000000000000..ee75e27475a1c --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.solutions { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.solutions; + exports com.azure.resourcemanager.solutions.fluent; + exports com.azure.resourcemanager.solutions.fluent.models; + exports com.azure.resourcemanager.solutions.models; + + opens com.azure.resourcemanager.solutions.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.solutions.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsCreateOrUpdateSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..70829f0697a6f --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsCreateOrUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.resourcemanager.solutions.models.ApplicationAuthorization; +import com.azure.resourcemanager.solutions.models.ApplicationLockLevel; +import java.util.Arrays; + +/** Samples for ApplicationDefinitions CreateOrUpdate. */ +public final class ApplicationDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json + */ + /** + * Sample code: Create or update managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager + .applicationDefinitions() + .define("myManagedApplicationDef") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withLockLevel(ApplicationLockLevel.NONE) + .withDisplayName("myManagedApplicationDef") + .withAuthorizations( + Arrays + .asList( + new ApplicationAuthorization() + .withPrincipalId("validprincipalguid") + .withRoleDefinitionId("validroleguid"))) + .withDescription("myManagedApplicationDef description") + .withPackageFileUri("https://path/to/packagezipfile") + .create(); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsDeleteSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsDeleteSamples.java new file mode 100644 index 0000000000000..e571928c8c980 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions Delete. */ +public final class ApplicationDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json + */ + /** + * Sample code: delete managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void deleteManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().delete("rg", "myManagedApplicationDef", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsGetByResourceGroupSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4d5403eaa5149 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions GetByResourceGroup. */ +public final class ApplicationDefinitionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json + */ + /** + * Sample code: Get managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void getManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().getByResourceGroupWithResponse("rg", "myManagedApplicationDef", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsListByResourceGroupSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..9f3fec980d535 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions ListByResourceGroup. */ +public final class ApplicationDefinitionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json + */ + /** + * Sample code: List managed application definitions. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listManagedApplicationDefinitions( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().listByResourceGroup("rg", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsListSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsListSamples.java new file mode 100644 index 0000000000000..b33c0c93062e0 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationDefinitions List. */ +public final class ApplicationDefinitionsListSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json + */ + /** + * Sample code: List managed application definitions. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listManagedApplicationDefinitions( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applicationDefinitions().list(Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsUpdateSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsUpdateSamples.java new file mode 100644 index 0000000000000..0d473da2a2183 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationDefinitionsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.models.ApplicationDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationDefinitions Update. */ +public final class ApplicationDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json + */ + /** + * Sample code: Update managed application definition. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void updateManagedApplicationDefinition( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + ApplicationDefinition resource = + manager + .applicationDefinitions() + .getByResourceGroupWithResponse("rg", "myManagedApplicationDef", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsCreateOrUpdateSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3a8a4efe6e891 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +/** Samples for Applications CreateOrUpdate. */ +public final class ApplicationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplication.json + */ + /** + * Sample code: Create or update managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateManagedApplication( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager + .applications() + .define("myManagedApplication") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withKind("ServiceCatalog") + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") + .create(); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsDeleteSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsDeleteSamples.java new file mode 100644 index 0000000000000..34736fff9fd70 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for Applications Delete. */ +public final class ApplicationsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplication.json + */ + /** + * Sample code: Delete managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void deleteManagedApplication(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().delete("rg", "myManagedApplication", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsGetByResourceGroupSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4d271ce8fa3bc --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for Applications GetByResourceGroup. */ +public final class ApplicationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplication.json + */ + /** + * Sample code: Get a managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void getAManagedApplication(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().getByResourceGroupWithResponse("rg", "myManagedApplication", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListAllowedUpgradePlansSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListAllowedUpgradePlansSamples.java new file mode 100644 index 0000000000000..fd74221207ee9 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListAllowedUpgradePlansSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for Applications ListAllowedUpgradePlans. */ +public final class ApplicationsListAllowedUpgradePlansSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listAllowedUpgradePlans.json + */ + /** + * Sample code: List allowed upgrade plans for application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listAllowedUpgradePlansForApplication( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().listAllowedUpgradePlansWithResponse("rg", "myManagedApplication", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListByResourceGroupSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..07c26ebb553df --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for Applications ListByResourceGroup. */ +public final class ApplicationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json + */ + /** + * Sample code: Lists applications. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listsApplications(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().listByResourceGroup("rg", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListSamples.java new file mode 100644 index 0000000000000..ceda38cebf4f1 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for Applications List. */ +public final class ApplicationsListSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json + */ + /** + * Sample code: Lists applications. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listsApplications(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().list(Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsRefreshPermissionsSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsRefreshPermissionsSamples.java new file mode 100644 index 0000000000000..9fd1872e7c6d1 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsRefreshPermissionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for Applications RefreshPermissions. */ +public final class ApplicationsRefreshPermissionsSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/refreshApplicationPermissions.json + */ + /** + * Sample code: Refresh managed application permissions. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void refreshManagedApplicationPermissions( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.applications().refreshPermissions("rg", "myManagedApplication", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsUpdateSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsUpdateSamples.java new file mode 100644 index 0000000000000..f52dbe0072bb9 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ApplicationsUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.models.Application; + +/** Samples for Applications Update. */ +public final class ApplicationsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplication.json + */ + /** + * Sample code: Create or update managed application. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateManagedApplication( + com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + Application resource = + manager + .applications() + .getByResourceGroupWithResponse("rg", "myManagedApplication", Context.NONE) + .getValue(); + resource + .update() + .withKind("ServiceCatalog") + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") + .apply(); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsCreateOrUpdateSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1c9b8a2865cae --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.resourcemanager.solutions.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.solutions.models.JitSchedulingPolicy; +import com.azure.resourcemanager.solutions.models.JitSchedulingType; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for JitRequests CreateOrUpdate. */ +public final class JitRequestsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager + .jitRequests() + .define("myJitRequest") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withApplicationResourceId( + "/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158") + .withJitAuthorizationPolicies( + Arrays + .asList( + new JitAuthorizationPolicies() + .withPrincipalId("1db8e132e2934dbcb8e1178a61319491") + .withRoleDefinitionId("ecd05a23-931a-4c38-a52b-ac7c4c583334"))) + .withJitSchedulingPolicy( + new JitSchedulingPolicy() + .withType(JitSchedulingType.ONCE) + .withDuration(Duration.parse("PT8H")) + .withStartTime(OffsetDateTime.parse("2021-04-22T05:48:30.6661804Z"))) + .create(); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsDeleteSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsDeleteSamples.java new file mode 100644 index 0000000000000..cc62a2769aac8 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for JitRequests Delete. */ +public final class JitRequestsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteJitRequest.json + */ + /** + * Sample code: Delete jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void deleteJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().deleteWithResponse("rg", "myJitRequest", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsGetByResourceGroupSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9252c2bdeafa7 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for JitRequests GetByResourceGroup. */ +public final class JitRequestsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().getByResourceGroupWithResponse("rg", "myJitRequest", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsListByResourceGroupSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..98174bb1188f6 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for JitRequests ListByResourceGroup. */ +public final class JitRequestsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: List jit requests. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listJitRequests(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().listByResourceGroupWithResponse("rg", Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsListBySubscriptionSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsListBySubscriptionSamples.java new file mode 100644 index 0000000000000..f03fb01511a76 --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsListBySubscriptionSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for JitRequests ListBySubscription. */ +public final class JitRequestsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: List jit requests. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listJitRequests(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.jitRequests().listBySubscriptionWithResponse(Context.NONE); + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsUpdateSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsUpdateSamples.java new file mode 100644 index 0000000000000..26b3974962ceb --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/JitRequestsUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.solutions.models.JitRequestDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JitRequests Update. */ +public final class JitRequestsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void createOrUpdateJitRequest(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + JitRequestDefinition resource = + manager.jitRequests().getByResourceGroupWithResponse("rg", "myJitRequest", Context.NONE).getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ResourceProviderListOperationsSamples.java b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ResourceProviderListOperationsSamples.java new file mode 100644 index 0000000000000..4a1bc71fb3adf --- /dev/null +++ b/sdk/solutions/azure-resourcemanager-solutions/src/samples/java/com/azure/resourcemanager/solutions/generated/ResourceProviderListOperationsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.solutions.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider ListOperations. */ +public final class ResourceProviderListOperationsSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listSolutionsOperations.json + */ + /** + * Sample code: List Solutions operations. + * + * @param manager Entry point to ManagedApplicationManager. + */ + public static void listSolutionsOperations(com.azure.resourcemanager.solutions.ManagedApplicationManager manager) { + manager.resourceProviders().listOperations(Context.NONE); + } +} diff --git a/sdk/solutions/ci.yml b/sdk/solutions/ci.yml new file mode 100644 index 0000000000000..b622f05f7d07a --- /dev/null +++ b/sdk/solutions/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/solutions/ci.yml + - sdk/solutions/azure-resourcemanager-solutions/ + exclude: + - sdk/solutions/pom.xml + - sdk/solutions/azure-resourcemanager-solutions/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/solutions/ci.yml + - sdk/solutions/azure-resourcemanager-solutions/ + exclude: + - sdk/solutions/pom.xml + - sdk/solutions/azure-resourcemanager-solutions/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: solutions + Artifacts: + - name: azure-resourcemanager-solutions + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersolutions diff --git a/sdk/solutions/pom.xml b/sdk/solutions/pom.xml new file mode 100644 index 0000000000000..d7c5274a330ab --- /dev/null +++ b/sdk/solutions/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-solutions-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-solutions + + + +