diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index e6327b68232c..e1dd61e761a7 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -355,6 +355,7 @@ com.azure.resourcemanager:azure-resourcemanager-education;1.0.0-beta.2;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-orbital;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-networkfunction;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-resourceconnector;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-devcenter;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index e1dcf8968700..46bff16e52b1 100644 --- a/pom.xml +++ b/pom.xml @@ -890,6 +890,7 @@ sdk/delegatednetwork sdk/deploymentmanager sdk/desktopvirtualization + sdk/devcenter sdk/deviceprovisioningservices sdk/deviceupdate sdk/devspaces diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/CHANGELOG.md b/sdk/devcenter/azure-resourcemanager-devcenter/CHANGELOG.md new file mode 100644 index 000000000000..3300fdab219a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-07-14) + +- Azure Resource Manager DevCenter client library for Java. This package contains Microsoft Azure SDK for DevCenter Management SDK. DevCenter Management API. Package tag package-2022-08-01-preview. 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/devcenter/azure-resourcemanager-devcenter/README.md b/sdk/devcenter/azure-resourcemanager-devcenter/README.md new file mode 100644 index 000000000000..4cbdbaf562ca --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager DevCenter client library for Java + +Azure Resource Manager DevCenter client library for Java. + +This package contains Microsoft Azure SDK for DevCenter Management SDK. DevCenter Management API. Package tag package-2022-08-01-preview. 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-devcenter;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-devcenter + 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(); +DevCenterManager manager = DevCenterManager + .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/devcenter/azure-resourcemanager-devcenter/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/devcenter/azure-resourcemanager-devcenter/SAMPLE.md b/sdk/devcenter/azure-resourcemanager-devcenter/SAMPLE.md new file mode 100644 index 000000000000..2c092eb4d6e7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/SAMPLE.md @@ -0,0 +1,2004 @@ +# Code snippets and samples + + +## AttachedNetworks + +- [CreateOrUpdate](#attachednetworks_createorupdate) +- [Delete](#attachednetworks_delete) +- [GetByDevCenter](#attachednetworks_getbydevcenter) +- [GetByProject](#attachednetworks_getbyproject) +- [ListByDevCenter](#attachednetworks_listbydevcenter) +- [ListByProject](#attachednetworks_listbyproject) + +## Catalogs + +- [CreateOrUpdate](#catalogs_createorupdate) +- [Delete](#catalogs_delete) +- [Get](#catalogs_get) +- [ListByDevCenter](#catalogs_listbydevcenter) +- [Sync](#catalogs_sync) +- [Update](#catalogs_update) + +## DevBoxDefinitions + +- [CreateOrUpdate](#devboxdefinitions_createorupdate) +- [Delete](#devboxdefinitions_delete) +- [Get](#devboxdefinitions_get) +- [GetByProject](#devboxdefinitions_getbyproject) +- [ListByDevCenter](#devboxdefinitions_listbydevcenter) +- [ListByProject](#devboxdefinitions_listbyproject) +- [Update](#devboxdefinitions_update) + +## DevCenters + +- [CreateOrUpdate](#devcenters_createorupdate) +- [Delete](#devcenters_delete) +- [GetByResourceGroup](#devcenters_getbyresourcegroup) +- [List](#devcenters_list) +- [ListByResourceGroup](#devcenters_listbyresourcegroup) +- [Update](#devcenters_update) + +## EnvironmentTypes + +- [CreateOrUpdate](#environmenttypes_createorupdate) +- [Delete](#environmenttypes_delete) +- [Get](#environmenttypes_get) +- [ListByDevCenter](#environmenttypes_listbydevcenter) +- [Update](#environmenttypes_update) + +## Galleries + +- [CreateOrUpdate](#galleries_createorupdate) +- [Delete](#galleries_delete) +- [Get](#galleries_get) +- [ListByDevCenter](#galleries_listbydevcenter) + +## ImageVersions + +- [Get](#imageversions_get) +- [ListByImage](#imageversions_listbyimage) + +## Images + +- [Get](#images_get) +- [ListByDevCenter](#images_listbydevcenter) +- [ListByGallery](#images_listbygallery) + +## NetworkConnections + +- [CreateOrUpdate](#networkconnections_createorupdate) +- [Delete](#networkconnections_delete) +- [GetByResourceGroup](#networkconnections_getbyresourcegroup) +- [GetHealthDetails](#networkconnections_gethealthdetails) +- [List](#networkconnections_list) +- [ListByResourceGroup](#networkconnections_listbyresourcegroup) +- [ListHealthDetails](#networkconnections_listhealthdetails) +- [RunHealthChecks](#networkconnections_runhealthchecks) +- [Update](#networkconnections_update) + +## OperationStatuses + +- [Get](#operationstatuses_get) + +## Operations + +- [List](#operations_list) + +## Pools + +- [CreateOrUpdate](#pools_createorupdate) +- [Delete](#pools_delete) +- [Get](#pools_get) +- [ListByProject](#pools_listbyproject) +- [Update](#pools_update) + +## ProjectEnvironmentTypes + +- [CreateOrUpdate](#projectenvironmenttypes_createorupdate) +- [Delete](#projectenvironmenttypes_delete) +- [Get](#projectenvironmenttypes_get) +- [List](#projectenvironmenttypes_list) +- [Update](#projectenvironmenttypes_update) + +## Projects + +- [CreateOrUpdate](#projects_createorupdate) +- [Delete](#projects_delete) +- [GetByResourceGroup](#projects_getbyresourcegroup) +- [List](#projects_list) +- [ListByResourceGroup](#projects_listbyresourcegroup) +- [Update](#projects_update) + +## Schedules + +- [CreateOrUpdate](#schedules_createorupdate) +- [Delete](#schedules_delete) +- [Get](#schedules_get) +- [ListByPool](#schedules_listbypool) +- [Update](#schedules_update) + +## Skus + +- [List](#skus_list) + +## Usages + +- [ListByLocation](#usages_listbylocation) +### AttachedNetworks_CreateOrUpdate + +```java +/** Samples for AttachedNetworks CreateOrUpdate. */ +public final class AttachedNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_Create.json + */ + /** + * Sample code: AttachedNetworks_Create. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksCreate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .attachedNetworks() + .define("{attachedNetworkConnectionName}") + .withExistingDevcenter("rg1", "Contoso") + .withNetworkConnectionId( + "/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3") + .create(); + } +} +``` + +### AttachedNetworks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks Delete. */ +public final class AttachedNetworksDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_Delete.json + */ + /** + * Sample code: AttachedNetworks_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().delete("rg1", "Contoso", "{attachedNetworkConnectionName}", Context.NONE); + } +} +``` + +### AttachedNetworks_GetByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks GetByDevCenter. */ +public final class AttachedNetworksGetByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_GetByDevCenter.json + */ + /** + * Sample code: AttachedNetworks_GetByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksGetByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().getByDevCenterWithResponse("rg1", "Contoso", "network-uswest3", Context.NONE); + } +} +``` + +### AttachedNetworks_GetByProject + +```java +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks GetByProject. */ +public final class AttachedNetworksGetByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_GetByProject.json + */ + /** + * Sample code: AttachedNetworks_GetByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksGetByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().getByProjectWithResponse("rg1", "{projectName}", "network-uswest3", Context.NONE); + } +} +``` + +### AttachedNetworks_ListByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks ListByDevCenter. */ +public final class AttachedNetworksListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_ListByDevCenter.json + */ + /** + * Sample code: AttachedNetworks_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} +``` + +### AttachedNetworks_ListByProject + +```java +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks ListByProject. */ +public final class AttachedNetworksListByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_ListByProject.json + */ + /** + * Sample code: AttachedNetworks_ListByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksListByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().listByProject("rg1", "{projectName}", null, Context.NONE); + } +} +``` + +### Catalogs_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.GitCatalog; + +/** Samples for Catalogs CreateOrUpdate. */ +public final class CatalogsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_CreateAdo.json + */ + /** + * Sample code: Catalogs_CreateOrUpdateAdo. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsCreateOrUpdateAdo(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .catalogs() + .define("{catalogName}") + .withExistingDevcenter("rg1", "Contoso") + .withAdoGit( + new GitCatalog() + .withUri("https://contoso@dev.azure.com/contoso/contosoOrg/_git/centralrepo-fakecontoso") + .withBranch("main") + .withSecretIdentifier("https://contosokv.vault.azure.net/secrets/CentralRepoPat") + .withPath("/templates")) + .create(); + } + + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_CreateGitHub.json + */ + /** + * Sample code: Catalogs_CreateOrUpdateGitHub. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsCreateOrUpdateGitHub(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .catalogs() + .define("{catalogName}") + .withExistingDevcenter("rg1", "Contoso") + .withGitHub( + new GitCatalog() + .withUri("https://github.com/Contoso/centralrepo-fake.git") + .withBranch("main") + .withSecretIdentifier("https://contosokv.vault.azure.net/secrets/CentralRepoPat") + .withPath("/templates")) + .create(); + } +} +``` + +### Catalogs_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Catalogs Delete. */ +public final class CatalogsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Delete.json + */ + /** + * Sample code: Catalogs_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().delete("rg1", "Contoso", "{catalogName}", Context.NONE); + } +} +``` + +### Catalogs_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Catalogs Get. */ +public final class CatalogsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Get.json + */ + /** + * Sample code: Catalogs_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().getWithResponse("rg1", "Contoso", "{catalogName}", Context.NONE); + } +} +``` + +### Catalogs_ListByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for Catalogs ListByDevCenter. */ +public final class CatalogsListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_List.json + */ + /** + * Sample code: Catalogs_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} +``` + +### Catalogs_Sync + +```java +import com.azure.core.util.Context; + +/** Samples for Catalogs Sync. */ +public final class CatalogsSyncSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Sync.json + */ + /** + * Sample code: Catalogs_Sync. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsSync(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().sync("rg1", "Contoso", "{catalogName}", Context.NONE); + } +} +``` + +### Catalogs_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.Catalog; +import com.azure.resourcemanager.devcenter.models.GitCatalog; + +/** Samples for Catalogs Update. */ +public final class CatalogsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Patch.json + */ + /** + * Sample code: Catalogs_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + Catalog resource = + manager.catalogs().getWithResponse("rg1", "Contoso", "{catalogName}", Context.NONE).getValue(); + resource.update().withGitHub(new GitCatalog().withPath("/environments")).apply(); + } +} +``` + +### DevBoxDefinitions_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.ImageReference; +import com.azure.resourcemanager.devcenter.models.Sku; + +/** Samples for DevBoxDefinitions CreateOrUpdate. */ +public final class DevBoxDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Create.json + */ + /** + * Sample code: DevBoxDefinitions_Create. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsCreate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .devBoxDefinitions() + .define("WebDevBox") + .withRegion("centralus") + .withExistingDevcenter("rg1", "Contoso") + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0")) + .withSku(new Sku().withName("Preview")) + .withOsStorageType("SSD_1024") + .create(); + } +} +``` + +### DevBoxDefinitions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions Delete. */ +public final class DevBoxDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Delete.json + */ + /** + * Sample code: DevBoxDefinitions_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().delete("rg1", "Contoso", "WebDevBox", Context.NONE); + } +} +``` + +### DevBoxDefinitions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions Get. */ +public final class DevBoxDefinitionsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Get.json + */ + /** + * Sample code: DevBoxDefinitions_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().getWithResponse("rg1", "Contoso", "WebDevBox", Context.NONE); + } +} +``` + +### DevBoxDefinitions_GetByProject + +```java +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions GetByProject. */ +public final class DevBoxDefinitionsGetByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_GetByProject.json + */ + /** + * Sample code: DevBoxDefinitions_GetByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsGetByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().getByProjectWithResponse("rg1", "ContosoProject", "WebDevBox", Context.NONE); + } +} +``` + +### DevBoxDefinitions_ListByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions ListByDevCenter. */ +public final class DevBoxDefinitionsListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_ListByDevCenter.json + */ + /** + * Sample code: DevBoxDefinitions_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} +``` + +### DevBoxDefinitions_ListByProject + +```java +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions ListByProject. */ +public final class DevBoxDefinitionsListByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_ListByProject.json + */ + /** + * Sample code: DevBoxDefinitions_ListByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsListByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().listByProject("rg1", "ContosoProject", null, Context.NONE); + } +} +``` + +### DevBoxDefinitions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinition; +import com.azure.resourcemanager.devcenter.models.ImageReference; + +/** Samples for DevBoxDefinitions Update. */ +public final class DevBoxDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Patch.json + */ + /** + * Sample code: DevBoxDefinitions_Patch. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsPatch(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + DevBoxDefinition resource = + manager.devBoxDefinitions().getWithResponse("rg1", "Contoso", "WebDevBox", Context.NONE).getValue(); + resource + .update() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/2.0.0")) + .apply(); + } +} +``` + +### DevCenters_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.devcenter.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DevCenters CreateOrUpdate. */ +public final class DevCentersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Create.json + */ + /** + * Sample code: DevCenters_Create. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersCreate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .devCenters() + .define("Contoso") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("CostCode", "12345")) + .create(); + } + + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_CreateWithUserIdentity.json + */ + /** + * Sample code: DevCenters_CreateWithUserIdentity. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersCreateWithUserIdentity(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .devCenters() + .define("Contoso") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("CostCode", "12345")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1", + new UserAssignedIdentity()))) + .create(); + } + + @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; + } +} +``` + +### DevCenters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DevCenters Delete. */ +public final class DevCentersDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Delete.json + */ + /** + * Sample code: DevCenters_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().delete("rg1", "Contoso", Context.NONE); + } +} +``` + +### DevCenters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DevCenters GetByResourceGroup. */ +public final class DevCentersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Get.json + */ + /** + * Sample code: DevCenters_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().getByResourceGroupWithResponse("rg1", "Contoso", Context.NONE); + } +} +``` + +### DevCenters_List + +```java +import com.azure.core.util.Context; + +/** Samples for DevCenters List. */ +public final class DevCentersListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_ListBySubscription.json + */ + /** + * Sample code: DevCenters_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersListBySubscription(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().list(null, Context.NONE); + } +} +``` + +### DevCenters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DevCenters ListByResourceGroup. */ +public final class DevCentersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_ListByResourceGroup.json + */ + /** + * Sample code: DevCenters_ListByResourceGroup. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersListByResourceGroup(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().listByResourceGroup("rg1", null, Context.NONE); + } +} +``` + +### DevCenters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.DevCenter; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DevCenters Update. */ +public final class DevCentersUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Patch.json + */ + /** + * Sample code: DevCenters_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + DevCenter resource = + manager.devCenters().getByResourceGroupWithResponse("rg1", "Contoso", Context.NONE).getValue(); + resource.update().withTags(mapOf("CostCode", "12345")).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; + } +} +``` + +### EnvironmentTypes_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for EnvironmentTypes CreateOrUpdate. */ +public final class EnvironmentTypesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Put.json + */ + /** + * Sample code: EnvironmentTypes_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .environmentTypes() + .define("{environmentTypeName}") + .withExistingDevcenter("rg1", "Contoso") + .withTags(mapOf("Owner", "superuser")) + .create(); + } + + @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; + } +} +``` + +### EnvironmentTypes_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for EnvironmentTypes Delete. */ +public final class EnvironmentTypesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Delete.json + */ + /** + * Sample code: EnvironmentTypes_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.environmentTypes().deleteWithResponse("rg1", "Contoso", "{environmentTypeName}", Context.NONE); + } +} +``` + +### EnvironmentTypes_Get + +```java +import com.azure.core.util.Context; + +/** Samples for EnvironmentTypes Get. */ +public final class EnvironmentTypesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Get.json + */ + /** + * Sample code: EnvironmentTypes_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.environmentTypes().getWithResponse("rg1", "Contoso", "{environmentTypeName}", Context.NONE); + } +} +``` + +### EnvironmentTypes_ListByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for EnvironmentTypes ListByDevCenter. */ +public final class EnvironmentTypesListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_List.json + */ + /** + * Sample code: EnvironmentTypes_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.environmentTypes().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} +``` + +### EnvironmentTypes_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.EnvironmentType; +import java.util.HashMap; +import java.util.Map; + +/** Samples for EnvironmentTypes Update. */ +public final class EnvironmentTypesUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Patch.json + */ + /** + * Sample code: EnvironmentTypes_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + EnvironmentType resource = + manager + .environmentTypes() + .getWithResponse("rg1", "Contoso", "{environmentTypeName}", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("Owner", "superuser")).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; + } +} +``` + +### Galleries_CreateOrUpdate + +```java +/** Samples for Galleries CreateOrUpdate. */ +public final class GalleriesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_Create.json + */ + /** + * Sample code: Galleries_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .galleries() + .define("{galleryName}") + .withExistingDevcenter("rg1", "Contoso") + .withGalleryResourceId( + "/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.Compute/galleries/{galleryName}") + .create(); + } +} +``` + +### Galleries_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Galleries Delete. */ +public final class GalleriesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_Delete.json + */ + /** + * Sample code: Galleries_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.galleries().delete("rg1", "Contoso", "{galleryName}", Context.NONE); + } +} +``` + +### Galleries_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Galleries Get. */ +public final class GalleriesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_Get.json + */ + /** + * Sample code: Galleries_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.galleries().getWithResponse("rg1", "Contoso", "{galleryName}", Context.NONE); + } +} +``` + +### Galleries_ListByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for Galleries ListByDevCenter. */ +public final class GalleriesListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_List.json + */ + /** + * Sample code: Galleries_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.galleries().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} +``` + +### ImageVersions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ImageVersions Get. */ +public final class ImageVersionsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ImageVersions_Get.json + */ + /** + * Sample code: Versions_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void versionsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .imageVersions() + .getWithResponse("rg1", "Contoso", "DefaultDevGallery", "Win11", "{versionName}", Context.NONE); + } +} +``` + +### ImageVersions_ListByImage + +```java +import com.azure.core.util.Context; + +/** Samples for ImageVersions ListByImage. */ +public final class ImageVersionsListByImageSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ImageVersions_List.json + */ + /** + * Sample code: ImageVersions_ListByImage. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imageVersionsListByImage(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.imageVersions().listByImage("rg1", "Contoso", "DefaultDevGallery", "Win11", Context.NONE); + } +} +``` + +### Images_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Images Get. */ +public final class ImagesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Images_Get.json + */ + /** + * Sample code: Images_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imagesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.images().getWithResponse("rg1", "Contoso", "DefaultDevGallery", "{imageName}", Context.NONE); + } +} +``` + +### Images_ListByDevCenter + +```java +import com.azure.core.util.Context; + +/** Samples for Images ListByDevCenter. */ +public final class ImagesListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Images_ListByDevCenter.json + */ + /** + * Sample code: Images_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imagesListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.images().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} +``` + +### Images_ListByGallery + +```java +import com.azure.core.util.Context; + +/** Samples for Images ListByGallery. */ +public final class ImagesListByGallerySamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Images_ListByGallery.json + */ + /** + * Sample code: Images_ListByGallery. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imagesListByGallery(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.images().listByGallery("rg1", "Contoso", "DevGallery", null, Context.NONE); + } +} +``` + +### NetworkConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.DomainJoinType; + +/** Samples for NetworkConnections CreateOrUpdate. */ +public final class NetworkConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Put.json + */ + /** + * Sample code: NetworkConnections_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .networkConnections() + .define("uswest3network") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withNetworkingResourceGroupName("NetworkInterfaces") + .withDomainJoinType(DomainJoinType.HYBRID_AZURE_ADJOIN) + .withSubnetId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default") + .withDomainName("mydomaincontroller.local") + .withDomainUsername("testuser@mydomaincontroller.local") + .withDomainPassword("Password value for user") + .create(); + } +} +``` + +### NetworkConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections Delete. */ +public final class NetworkConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Delete.json + */ + /** + * Sample code: NetworkConnections_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().delete("rg1", "{networkConnectionName}", Context.NONE); + } +} +``` + +### NetworkConnections_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections GetByResourceGroup. */ +public final class NetworkConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Get.json + */ + /** + * Sample code: NetworkConnections_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().getByResourceGroupWithResponse("rg1", "uswest3network", Context.NONE); + } +} +``` + +### NetworkConnections_GetHealthDetails + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections GetHealthDetails. */ +public final class NetworkConnectionsGetHealthDetailsSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_GetHealthDetails.json + */ + /** + * Sample code: NetworkConnections_GetHealthDetails. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsGetHealthDetails( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().getHealthDetailsWithResponse("rg1", "{networkConnectionName}", Context.NONE); + } +} +``` + +### NetworkConnections_List + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections List. */ +public final class NetworkConnectionsListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_ListBySubscription.json + */ + /** + * Sample code: NetworkConnections_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsListBySubscription( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().list(null, Context.NONE); + } +} +``` + +### NetworkConnections_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections ListByResourceGroup. */ +public final class NetworkConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_ListByResourceGroup.json + */ + /** + * Sample code: NetworkConnections_ListByResourceGroup. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsListByResourceGroup( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().listByResourceGroup("rg1", null, Context.NONE); + } +} +``` + +### NetworkConnections_ListHealthDetails + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections ListHealthDetails. */ +public final class NetworkConnectionsListHealthDetailsSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_ListHealthDetails.json + */ + /** + * Sample code: NetworkConnections_ListHealthDetails. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsListHealthDetails( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().listHealthDetails("rg1", "uswest3network", null, Context.NONE); + } +} +``` + +### NetworkConnections_RunHealthChecks + +```java +import com.azure.core.util.Context; + +/** Samples for NetworkConnections RunHealthChecks. */ +public final class NetworkConnectionsRunHealthChecksSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_RunHealthChecks.json + */ + /** + * Sample code: NetworkConnections_RunHealthChecks. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsRunHealthChecks(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().runHealthChecksWithResponse("rg1", "uswest3network", Context.NONE); + } +} +``` + +### NetworkConnections_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.NetworkConnection; + +/** Samples for NetworkConnections Update. */ +public final class NetworkConnectionsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Patch.json + */ + /** + * Sample code: NetworkConnections_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + NetworkConnection resource = + manager + .networkConnections() + .getByResourceGroupWithResponse("rg1", "uswest3network", Context.NONE) + .getValue(); + resource.update().withDomainPassword("New Password value for user").apply(); + } +} +``` + +### OperationStatuses_Get + +```java +import com.azure.core.util.Context; + +/** Samples for OperationStatuses Get. */ +public final class OperationStatusesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/OperationStatus_Get.json + */ + /** + * Sample code: Get OperationStatus. + * + * @param manager Entry point to DevCenterManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.operationStatuses().getWithResponse("{location}", "{operationId}", Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Operations_Get.json + */ + /** + * Sample code: Operations_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void operationsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### Pools_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.LicenseType; +import com.azure.resourcemanager.devcenter.models.LocalAdminStatus; + +/** Samples for Pools CreateOrUpdate. */ +public final class PoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Put.json + */ + /** + * Sample code: Pools_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .pools() + .define("{poolName}") + .withRegion("centralus") + .withExistingProject("rg1", "{projectName}") + .withDevBoxDefinitionName("WebDevBox") + .withNetworkConnectionName("Network1-westus2") + .withLicenseType(LicenseType.WINDOWS_CLIENT) + .withLocalAdministrator(LocalAdminStatus.ENABLED) + .create(); + } +} +``` + +### Pools_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Pools Delete. */ +public final class PoolsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Delete.json + */ + /** + * Sample code: Pools_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.pools().delete("rg1", "{projectName}", "poolName", Context.NONE); + } +} +``` + +### Pools_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Pools Get. */ +public final class PoolsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Get.json + */ + /** + * Sample code: Pools_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.pools().getWithResponse("rg1", "{projectName}", "{poolName}", Context.NONE); + } +} +``` + +### Pools_ListByProject + +```java +import com.azure.core.util.Context; + +/** Samples for Pools ListByProject. */ +public final class PoolsListByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_List.json + */ + /** + * Sample code: Pools_ListByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsListByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.pools().listByProject("rg1", "{projectName}", null, Context.NONE); + } +} +``` + +### Pools_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.Pool; + +/** Samples for Pools Update. */ +public final class PoolsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Patch.json + */ + /** + * Sample code: Pools_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + Pool resource = manager.pools().getWithResponse("rg1", "{projectName}", "{poolName}", Context.NONE).getValue(); + resource.update().withDevBoxDefinitionName("WebDevBox2").apply(); + } +} +``` + +### ProjectEnvironmentTypes_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.EnvironmentRole; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment; +import com.azure.resourcemanager.devcenter.models.UserAssignedIdentity; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProjectEnvironmentTypes CreateOrUpdate. */ +public final class ProjectEnvironmentTypesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Put.json + */ + /** + * Sample code: ProjectEnvironmentTypes_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesCreateOrUpdate( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .projectEnvironmentTypes() + .define("{environmentTypeName}") + .withExistingProject("rg1", "ContosoProj") + .withTags(mapOf("CostCenter", "RnD")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1", + new UserAssignedIdentity()))) + .withDeploymentTargetId("/subscriptions/00000000-0000-0000-0000-000000000000") + .withStatus(EnableStatus.ENABLED) + .withCreatorRoleAssignment( + new ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment() + .withRoles(mapOf("4cbf0b6c-e750-441c-98a7-10da8387e4d6", new EnvironmentRole()))) + .withUserRoleAssignments( + mapOf( + "e45e3m7c-176e-416a-b466-0c5ec8298f8a", + new UserRoleAssignmentValue() + .withRoles(mapOf("4cbf0b6c-e750-441c-98a7-10da8387e4d6", new EnvironmentRole())))) + .create(); + } + + @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; + } +} +``` + +### ProjectEnvironmentTypes_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ProjectEnvironmentTypes Delete. */ +public final class ProjectEnvironmentTypesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Delete.json + */ + /** + * Sample code: ProjectEnvironmentTypes_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .projectEnvironmentTypes() + .deleteWithResponse("rg1", "ContosoProj", "{environmentTypeName}", Context.NONE); + } +} +``` + +### ProjectEnvironmentTypes_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ProjectEnvironmentTypes Get. */ +public final class ProjectEnvironmentTypesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Get.json + */ + /** + * Sample code: ProjectEnvironmentTypes_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projectEnvironmentTypes().getWithResponse("rg1", "ContosoProj", "{environmentTypeName}", Context.NONE); + } +} +``` + +### ProjectEnvironmentTypes_List + +```java +import com.azure.core.util.Context; + +/** Samples for ProjectEnvironmentTypes List. */ +public final class ProjectEnvironmentTypesListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_List.json + */ + /** + * Sample code: ProjectEnvironmentTypes_List. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesList(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projectEnvironmentTypes().list("rg1", "ContosoProj", null, Context.NONE); + } +} +``` + +### ProjectEnvironmentTypes_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.EnvironmentRole; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentType; +import com.azure.resourcemanager.devcenter.models.UserAssignedIdentity; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProjectEnvironmentTypes Update. */ +public final class ProjectEnvironmentTypesUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Patch.json + */ + /** + * Sample code: ProjectEnvironmentTypes_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + ProjectEnvironmentType resource = + manager + .projectEnvironmentTypes() + .getWithResponse("rg1", "ContosoProj", "{environmentTypeName}", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("CostCenter", "RnD")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1", + new UserAssignedIdentity()))) + .withDeploymentTargetId("/subscriptions/00000000-0000-0000-0000-000000000000") + .withStatus(EnableStatus.ENABLED) + .withUserRoleAssignments( + mapOf( + "e45e3m7c-176e-416a-b466-0c5ec8298f8a", + new UserRoleAssignmentValue() + .withRoles(mapOf("4cbf0b6c-e750-441c-98a7-10da8387e4d6", new EnvironmentRole())))) + .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; + } +} +``` + +### Projects_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for Projects CreateOrUpdate. */ +public final class ProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Put.json + */ + /** + * Sample code: Projects_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .projects() + .define("{projectName}") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("CostCenter", "R&D")) + .withDevCenterId( + "/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/{devCenterName}") + .withDescription("This is my first project.") + .create(); + } + + @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; + } +} +``` + +### Projects_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Projects Delete. */ +public final class ProjectsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Delete.json + */ + /** + * Sample code: Projects_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().delete("rg1", "{projectName}", Context.NONE); + } +} +``` + +### Projects_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Projects GetByResourceGroup. */ +public final class ProjectsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Get.json + */ + /** + * Sample code: Projects_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().getByResourceGroupWithResponse("rg1", "{projectName}", Context.NONE); + } +} +``` + +### Projects_List + +```java +import com.azure.core.util.Context; + +/** Samples for Projects List. */ +public final class ProjectsListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_ListBySubscription.json + */ + /** + * Sample code: Projects_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsListBySubscription(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().list(null, Context.NONE); + } +} +``` + +### Projects_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Projects ListByResourceGroup. */ +public final class ProjectsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_ListByResourceGroup.json + */ + /** + * Sample code: Projects_ListByResourceGroup. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsListByResourceGroup(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().listByResourceGroup("rg1", null, Context.NONE); + } +} +``` + +### Projects_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.Project; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Projects Update. */ +public final class ProjectsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Patch.json + */ + /** + * Sample code: Projects_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + Project resource = + manager.projects().getByResourceGroupWithResponse("rg1", "{projectName}", Context.NONE).getValue(); + resource.update().withTags(mapOf("CostCenter", "R&D")).withDescription("This is my first project.").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; + } +} +``` + +### Schedules_CreateOrUpdate + +```java +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ScheduledFrequency; +import com.azure.resourcemanager.devcenter.models.ScheduledType; + +/** Samples for Schedules CreateOrUpdate. */ +public final class SchedulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_CreateDailyShutdownPoolSchedule.json + */ + /** + * Sample code: Schedules_CreateDailyShutdownPoolSchedule. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesCreateDailyShutdownPoolSchedule( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .schedules() + .define("autoShutdown") + .withExistingPool("rg1", "DevProject", "DevPool") + .withTypePropertiesType(ScheduledType.STOP_DEV_BOX) + .withFrequency(ScheduledFrequency.DAILY) + .withTime("17:30") + .withTimeZone("America/Los_Angeles") + .withState(EnableStatus.ENABLED) + .create(); + } +} +``` + +### Schedules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Schedules Delete. */ +public final class SchedulesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_Delete.json + */ + /** + * Sample code: Schedules_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.schedules().delete("rg1", "TestProject", "DevPool", "autoShutdown", null, Context.NONE); + } +} +``` + +### Schedules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Schedules Get. */ +public final class SchedulesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_Get.json + */ + /** + * Sample code: Schedules_GetByPool. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesGetByPool(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.schedules().getWithResponse("rg1", "TestProject", "DevPool", "autoShutdown", null, Context.NONE); + } +} +``` + +### Schedules_ListByPool + +```java +import com.azure.core.util.Context; + +/** Samples for Schedules ListByPool. */ +public final class SchedulesListByPoolSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_ListByPool.json + */ + /** + * Sample code: Schedules_ListByPool. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesListByPool(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.schedules().listByPool("rg1", "TestProject", "DevPool", null, Context.NONE); + } +} +``` + +### Schedules_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.ScheduleUpdate; + +/** Samples for Schedules Update. */ +public final class SchedulesUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_Patch.json + */ + /** + * Sample code: Schedules_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .schedules() + .update( + "rg1", + "TestProject", + "DevPool", + "autoShutdown", + new ScheduleUpdate().withTime("18:00"), + null, + Context.NONE); + } +} +``` + +### Skus_List + +```java +import com.azure.core.util.Context; + +/** Samples for Skus List. */ +public final class SkusListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Skus_ListBySubscription.json + */ + /** + * Sample code: Skus_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void skusListBySubscription(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.skus().list(null, Context.NONE); + } +} +``` + +### Usages_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for Usages ListByLocation. */ +public final class UsagesListByLocationSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Usages_ListByLocation.json + */ + /** + * Sample code: listUsages. + * + * @param manager Entry point to DevCenterManager. + */ + public static void listUsages(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.usages().listByLocation("westus", Context.NONE); + } +} +``` + diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml b/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml new file mode 100644 index 000000000000..fa4686f5abba --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-devcenter + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DevCenter Management + This package contains Microsoft Azure SDK for DevCenter Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. DevCenter Management API. Package tag package-2022-08-01-preview. + 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 + + + + com.azure + azure-core + 1.30.0 + + + com.azure + azure-core-management + 1.7.0 + + + diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/DevCenterManager.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/DevCenterManager.java new file mode 100644 index 000000000000..eca27bc46390 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/DevCenterManager.java @@ -0,0 +1,539 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter; + +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.AddHeadersFromContextPolicy; +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.RetryOptions; +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.devcenter.fluent.DevCenterClient; +import com.azure.resourcemanager.devcenter.implementation.AttachedNetworksImpl; +import com.azure.resourcemanager.devcenter.implementation.CatalogsImpl; +import com.azure.resourcemanager.devcenter.implementation.DevBoxDefinitionsImpl; +import com.azure.resourcemanager.devcenter.implementation.DevCenterClientBuilder; +import com.azure.resourcemanager.devcenter.implementation.DevCentersImpl; +import com.azure.resourcemanager.devcenter.implementation.EnvironmentTypesImpl; +import com.azure.resourcemanager.devcenter.implementation.GalleriesImpl; +import com.azure.resourcemanager.devcenter.implementation.ImageVersionsImpl; +import com.azure.resourcemanager.devcenter.implementation.ImagesImpl; +import com.azure.resourcemanager.devcenter.implementation.NetworkConnectionsImpl; +import com.azure.resourcemanager.devcenter.implementation.OperationStatusesImpl; +import com.azure.resourcemanager.devcenter.implementation.OperationsImpl; +import com.azure.resourcemanager.devcenter.implementation.PoolsImpl; +import com.azure.resourcemanager.devcenter.implementation.ProjectEnvironmentTypesImpl; +import com.azure.resourcemanager.devcenter.implementation.ProjectsImpl; +import com.azure.resourcemanager.devcenter.implementation.SchedulesImpl; +import com.azure.resourcemanager.devcenter.implementation.SkusImpl; +import com.azure.resourcemanager.devcenter.implementation.UsagesImpl; +import com.azure.resourcemanager.devcenter.models.AttachedNetworks; +import com.azure.resourcemanager.devcenter.models.Catalogs; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinitions; +import com.azure.resourcemanager.devcenter.models.DevCenters; +import com.azure.resourcemanager.devcenter.models.EnvironmentTypes; +import com.azure.resourcemanager.devcenter.models.Galleries; +import com.azure.resourcemanager.devcenter.models.ImageVersions; +import com.azure.resourcemanager.devcenter.models.Images; +import com.azure.resourcemanager.devcenter.models.NetworkConnections; +import com.azure.resourcemanager.devcenter.models.OperationStatuses; +import com.azure.resourcemanager.devcenter.models.Operations; +import com.azure.resourcemanager.devcenter.models.Pools; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypes; +import com.azure.resourcemanager.devcenter.models.Projects; +import com.azure.resourcemanager.devcenter.models.Schedules; +import com.azure.resourcemanager.devcenter.models.Skus; +import com.azure.resourcemanager.devcenter.models.Usages; +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 DevCenterManager. DevCenter Management API. */ +public final class DevCenterManager { + private DevCenters devCenters; + + private Projects projects; + + private AttachedNetworks attachedNetworks; + + private Galleries galleries; + + private Images images; + + private ImageVersions imageVersions; + + private Catalogs catalogs; + + private EnvironmentTypes environmentTypes; + + private ProjectEnvironmentTypes projectEnvironmentTypes; + + private DevBoxDefinitions devBoxDefinitions; + + private Operations operations; + + private OperationStatuses operationStatuses; + + private Usages usages; + + private Skus skus; + + private Pools pools; + + private Schedules schedules; + + private NetworkConnections networkConnections; + + private final DevCenterClient clientObject; + + private DevCenterManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new DevCenterClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of DevCenter service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DevCenter service API instance. + */ + public static DevCenterManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of DevCenter service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the DevCenter service API instance. + */ + public static DevCenterManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DevCenterManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DevCenterManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DevCenterManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static 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 RetryOptions retryOptions; + 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 retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of DevCenter service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DevCenter service API instance. + */ + public DevCenterManager 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.devcenter") + .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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + 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 DevCenterManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of DevCenters. It manages DevCenter. + * + * @return Resource collection API of DevCenters. + */ + public DevCenters devCenters() { + if (this.devCenters == null) { + this.devCenters = new DevCentersImpl(clientObject.getDevCenters(), this); + } + return devCenters; + } + + /** + * Gets the resource collection API of Projects. It manages Project. + * + * @return Resource collection API of Projects. + */ + public Projects projects() { + if (this.projects == null) { + this.projects = new ProjectsImpl(clientObject.getProjects(), this); + } + return projects; + } + + /** + * Gets the resource collection API of AttachedNetworks. It manages AttachedNetworkConnection. + * + * @return Resource collection API of AttachedNetworks. + */ + public AttachedNetworks attachedNetworks() { + if (this.attachedNetworks == null) { + this.attachedNetworks = new AttachedNetworksImpl(clientObject.getAttachedNetworks(), this); + } + return attachedNetworks; + } + + /** + * Gets the resource collection API of Galleries. It manages Gallery. + * + * @return Resource collection API of Galleries. + */ + public Galleries galleries() { + if (this.galleries == null) { + this.galleries = new GalleriesImpl(clientObject.getGalleries(), this); + } + return galleries; + } + + /** + * Gets the resource collection API of Images. + * + * @return Resource collection API of Images. + */ + public Images images() { + if (this.images == null) { + this.images = new ImagesImpl(clientObject.getImages(), this); + } + return images; + } + + /** + * Gets the resource collection API of ImageVersions. + * + * @return Resource collection API of ImageVersions. + */ + public ImageVersions imageVersions() { + if (this.imageVersions == null) { + this.imageVersions = new ImageVersionsImpl(clientObject.getImageVersions(), this); + } + return imageVersions; + } + + /** + * Gets the resource collection API of Catalogs. It manages Catalog. + * + * @return Resource collection API of Catalogs. + */ + public Catalogs catalogs() { + if (this.catalogs == null) { + this.catalogs = new CatalogsImpl(clientObject.getCatalogs(), this); + } + return catalogs; + } + + /** + * Gets the resource collection API of EnvironmentTypes. It manages EnvironmentType. + * + * @return Resource collection API of EnvironmentTypes. + */ + public EnvironmentTypes environmentTypes() { + if (this.environmentTypes == null) { + this.environmentTypes = new EnvironmentTypesImpl(clientObject.getEnvironmentTypes(), this); + } + return environmentTypes; + } + + /** + * Gets the resource collection API of ProjectEnvironmentTypes. It manages ProjectEnvironmentType. + * + * @return Resource collection API of ProjectEnvironmentTypes. + */ + public ProjectEnvironmentTypes projectEnvironmentTypes() { + if (this.projectEnvironmentTypes == null) { + this.projectEnvironmentTypes = + new ProjectEnvironmentTypesImpl(clientObject.getProjectEnvironmentTypes(), this); + } + return projectEnvironmentTypes; + } + + /** + * Gets the resource collection API of DevBoxDefinitions. It manages DevBoxDefinition. + * + * @return Resource collection API of DevBoxDefinitions. + */ + public DevBoxDefinitions devBoxDefinitions() { + if (this.devBoxDefinitions == null) { + this.devBoxDefinitions = new DevBoxDefinitionsImpl(clientObject.getDevBoxDefinitions(), this); + } + return devBoxDefinitions; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of OperationStatuses. + * + * @return Resource collection API of OperationStatuses. + */ + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); + } + return operationStatuses; + } + + /** + * Gets the resource collection API of Usages. + * + * @return Resource collection API of Usages. + */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** + * Gets the resource collection API of Skus. + * + * @return Resource collection API of Skus. + */ + public Skus skus() { + if (this.skus == null) { + this.skus = new SkusImpl(clientObject.getSkus(), this); + } + return skus; + } + + /** + * Gets the resource collection API of Pools. It manages Pool. + * + * @return Resource collection API of Pools. + */ + public Pools pools() { + if (this.pools == null) { + this.pools = new PoolsImpl(clientObject.getPools(), this); + } + return pools; + } + + /** + * Gets the resource collection API of Schedules. It manages Schedule. + * + * @return Resource collection API of Schedules. + */ + public Schedules schedules() { + if (this.schedules == null) { + this.schedules = new SchedulesImpl(clientObject.getSchedules(), this); + } + return schedules; + } + + /** + * Gets the resource collection API of NetworkConnections. It manages NetworkConnection. + * + * @return Resource collection API of NetworkConnections. + */ + public NetworkConnections networkConnections() { + if (this.networkConnections == null) { + this.networkConnections = new NetworkConnectionsImpl(clientObject.getNetworkConnections(), this); + } + return networkConnections; + } + + /** + * @return Wrapped service client DevCenterClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public DevCenterClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/AttachedNetworksClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/AttachedNetworksClient.java new file mode 100644 index 000000000000..65a025a1d26e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/AttachedNetworksClient.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.AttachedNetworkConnectionInner; + +/** An instance of this class provides access to all the operations defined in AttachedNetworksClient. */ +public interface AttachedNetworksClient { + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProject(String resourceGroupName, String projectName); + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttachedNetworkConnectionInner getByProject( + String resourceGroupName, String projectName, String attachedNetworkConnectionName); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByProjectWithResponse( + String resourceGroupName, String projectName, String attachedNetworkConnectionName, Context context); + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttachedNetworkConnectionInner getByDevCenter( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByDevCenterWithResponse( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context); + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AttachedNetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body); + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AttachedNetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + Context context); + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttachedNetworkConnectionInner createOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body); + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttachedNetworkConnectionInner createOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + Context context); + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName); + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context); + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 devCenterName, String attachedNetworkConnectionName); + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 devCenterName, String attachedNetworkConnectionName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/CatalogsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/CatalogsClient.java new file mode 100644 index 000000000000..821645421e3b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/CatalogsClient.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.CatalogInner; +import com.azure.resourcemanager.devcenter.models.CatalogUpdate; + +/** An instance of this class provides access to all the operations defined in CatalogsClient. */ +public interface CatalogsClient { + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner get(String resourceGroupName, String devCenterName, String catalogName); + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String devCenterName, String catalogName, Context context); + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body); + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, Context context); + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner createOrUpdate(String resourceGroupName, String devCenterName, String catalogName, CatalogInner body); + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner createOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, Context context); + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CatalogInner> beginUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body); + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CatalogInner> beginUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, Context context); + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner update(String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body); + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner update( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, Context context); + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String devCenterName, String catalogName); + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String catalogName, Context context); + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 devCenterName, String catalogName); + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 devCenterName, String catalogName, Context context); + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSync(String resourceGroupName, String devCenterName, String catalogName); + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSync( + String resourceGroupName, String devCenterName, String catalogName, Context context); + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 sync(String resourceGroupName, String devCenterName, String catalogName); + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 sync(String resourceGroupName, String devCenterName, String catalogName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevBoxDefinitionsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevBoxDefinitionsClient.java new file mode 100644 index 000000000000..2138efe2515d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevBoxDefinitionsClient.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.DevBoxDefinitionInner; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinitionUpdate; + +/** An instance of this class provides access to all the operations defined in DevBoxDefinitionsClient. */ +public interface DevBoxDefinitionsClient { + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevBoxDefinitionInner get(String resourceGroupName, String devCenterName, String devBoxDefinitionName); + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context); + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevBoxDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body); + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevBoxDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + Context context); + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevBoxDefinitionInner createOrUpdate( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body); + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevBoxDefinitionInner createOrUpdate( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + Context context); + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevBoxDefinitionInner> beginUpdate( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body); + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevBoxDefinitionInner> beginUpdate( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + Context context); + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevBoxDefinitionInner update( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body); + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevBoxDefinitionInner update( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + Context context); + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String devBoxDefinitionName); + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context); + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 devCenterName, String devBoxDefinitionName); + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 devCenterName, String devBoxDefinitionName, Context context); + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProject(String resourceGroupName, String projectName); + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevBoxDefinitionInner getByProject(String resourceGroupName, String projectName, String devBoxDefinitionName); + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByProjectWithResponse( + String resourceGroupName, String projectName, String devBoxDefinitionName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevCenterClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevCenterClient.java new file mode 100644 index 000000000000..f1eea14962e7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevCenterClient.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for DevCenterClient class. */ +public interface DevCenterClient { + /** + * Gets Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @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 DevCentersClient object to access its operations. + * + * @return the DevCentersClient object. + */ + DevCentersClient getDevCenters(); + + /** + * Gets the ProjectsClient object to access its operations. + * + * @return the ProjectsClient object. + */ + ProjectsClient getProjects(); + + /** + * Gets the AttachedNetworksClient object to access its operations. + * + * @return the AttachedNetworksClient object. + */ + AttachedNetworksClient getAttachedNetworks(); + + /** + * Gets the GalleriesClient object to access its operations. + * + * @return the GalleriesClient object. + */ + GalleriesClient getGalleries(); + + /** + * Gets the ImagesClient object to access its operations. + * + * @return the ImagesClient object. + */ + ImagesClient getImages(); + + /** + * Gets the ImageVersionsClient object to access its operations. + * + * @return the ImageVersionsClient object. + */ + ImageVersionsClient getImageVersions(); + + /** + * Gets the CatalogsClient object to access its operations. + * + * @return the CatalogsClient object. + */ + CatalogsClient getCatalogs(); + + /** + * Gets the EnvironmentTypesClient object to access its operations. + * + * @return the EnvironmentTypesClient object. + */ + EnvironmentTypesClient getEnvironmentTypes(); + + /** + * Gets the ProjectEnvironmentTypesClient object to access its operations. + * + * @return the ProjectEnvironmentTypesClient object. + */ + ProjectEnvironmentTypesClient getProjectEnvironmentTypes(); + + /** + * Gets the DevBoxDefinitionsClient object to access its operations. + * + * @return the DevBoxDefinitionsClient object. + */ + DevBoxDefinitionsClient getDevBoxDefinitions(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + OperationStatusesClient getOperationStatuses(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + SkusClient getSkus(); + + /** + * Gets the PoolsClient object to access its operations. + * + * @return the PoolsClient object. + */ + PoolsClient getPools(); + + /** + * Gets the SchedulesClient object to access its operations. + * + * @return the SchedulesClient object. + */ + SchedulesClient getSchedules(); + + /** + * Gets the NetworkConnectionsClient object to access its operations. + * + * @return the NetworkConnectionsClient object. + */ + NetworkConnectionsClient getNetworkConnections(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevCentersClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevCentersClient.java new file mode 100644 index 000000000000..da1f3af1a774 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/DevCentersClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.DevCenterInner; +import com.azure.resourcemanager.devcenter.models.DevCenterUpdate; + +/** An instance of this class provides access to all the operations defined in DevCentersClient. */ +public interface DevCentersClient { + /** + * Lists all devcenters in 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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, Context context); + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevCenterInner getByResourceGroup(String resourceGroupName, String devCenterName); + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String devCenterName, Context context); + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevCenterInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, DevCenterInner body); + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevCenterInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, DevCenterInner body, Context context); + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevCenterInner createOrUpdate(String resourceGroupName, String devCenterName, DevCenterInner body); + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevCenterInner createOrUpdate(String resourceGroupName, String devCenterName, DevCenterInner body, Context context); + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevCenterInner> beginUpdate( + String resourceGroupName, String devCenterName, DevCenterUpdate body); + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevCenterInner> beginUpdate( + String resourceGroupName, String devCenterName, DevCenterUpdate body, Context context); + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevCenterInner update(String resourceGroupName, String devCenterName, DevCenterUpdate body); + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevCenterInner update(String resourceGroupName, String devCenterName, DevCenterUpdate body, Context context); + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String devCenterName); + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String devCenterName, Context context); + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devCenterName); + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devCenterName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/EnvironmentTypesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/EnvironmentTypesClient.java new file mode 100644 index 000000000000..874ad99e4368 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/EnvironmentTypesClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.EnvironmentTypeUpdate; + +/** An instance of this class provides access to all the operations defined in EnvironmentTypesClient. */ +public interface EnvironmentTypesClient { + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 result of the environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentTypeInner get(String resourceGroupName, String devCenterName, String environmentTypeName); + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context); + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentTypeInner createOrUpdate( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeInner body); + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String devCenterName, + String environmentTypeName, + EnvironmentTypeInner body, + Context context); + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentTypeInner update( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeUpdate body); + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String devCenterName, + String environmentTypeName, + EnvironmentTypeUpdate body, + Context context); + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 devCenterName, String environmentTypeName); + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/GalleriesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/GalleriesClient.java new file mode 100644 index 000000000000..874548c94300 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/GalleriesClient.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.devcenter.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.devcenter.fluent.models.GalleryInner; + +/** An instance of this class provides access to all the operations defined in GalleriesClient. */ +public interface GalleriesClient { + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the gallery list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner get(String resourceGroupName, String devCenterName, String galleryName); + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, Context context); + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a gallery. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body); + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a gallery. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, Context context); + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner createOrUpdate(String resourceGroupName, String devCenterName, String galleryName, GalleryInner body); + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner createOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, Context context); + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String devCenterName, String galleryName); + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String galleryName, Context context); + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 devCenterName, String galleryName); + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 devCenterName, String galleryName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ImageVersionsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ImageVersionsClient.java new file mode 100644 index 000000000000..119b7dc03e0d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ImageVersionsClient.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.devcenter.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.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner; + +/** An instance of this class provides access to all the operations defined in ImageVersionsClient. */ +public interface ImageVersionsClient { + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName); + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context); + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageVersionInner get( + String resourceGroupName, String devCenterName, String galleryName, String imageName, String versionName); + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String devCenterName, + String galleryName, + String imageName, + String versionName, + Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ImagesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ImagesClient.java new file mode 100644 index 000000000000..c464c13d77d7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ImagesClient.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.devcenter.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.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ImageInner; + +/** An instance of this class provides access to all the operations defined in ImagesClient. */ +public interface ImagesClient { + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGallery(String resourceGroupName, String devCenterName, String galleryName); + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGallery( + String resourceGroupName, String devCenterName, String galleryName, Integer top, Context context); + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner get(String resourceGroupName, String devCenterName, String galleryName, String imageName); + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/NetworkConnectionsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/NetworkConnectionsClient.java new file mode 100644 index 000000000000..452d35316f16 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/NetworkConnectionsClient.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.HealthCheckStatusDetailsInner; +import com.azure.resourcemanager.devcenter.fluent.models.NetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.NetworkConnectionUpdate; + +/** An instance of this class provides access to all the operations defined in NetworkConnectionsClient. */ +public interface NetworkConnectionsClient { + /** + * Lists network connections in 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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, Context context); + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkConnectionInner getByResourceGroup(String resourceGroupName, String networkConnectionName); + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String networkConnectionName, Context context); + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body); + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, Context context); + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkConnectionInner createOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body); + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkConnectionInner createOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, Context context); + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkConnectionInner> beginUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body); + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkConnectionInner> beginUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, Context context); + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkConnectionInner update(String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body); + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkConnectionInner update( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, Context context); + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String networkConnectionName); + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String networkConnectionName, Context context); + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 networkConnectionName); + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 networkConnectionName, Context context); + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 result of the network health check list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName); + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName, Integer top, Context context); + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthCheckStatusDetailsInner getHealthDetails(String resourceGroupName, String networkConnectionName); + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getHealthDetailsWithResponse( + String resourceGroupName, String networkConnectionName, Context context); + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 runHealthChecks(String resourceGroupName, String networkConnectionName); + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response runHealthChecksWithResponse(String resourceGroupName, String networkConnectionName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/OperationStatusesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/OperationStatusesClient.java new file mode 100644 index 000000000000..6a40527de3b1 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/OperationStatusesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.OperationStatusInner; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public interface OperationStatusesClient { + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusInner get(String location, String operationId); + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/OperationsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/OperationsClient.java new file mode 100644 index 000000000000..45674cb4b905 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/OperationsClient.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.devcenter.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.devcenter.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/PoolsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/PoolsClient.java new file mode 100644 index 000000000000..cc83d16a0b6b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/PoolsClient.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.PoolInner; +import com.azure.resourcemanager.devcenter.models.PoolUpdate; + +/** An instance of this class provides access to all the operations defined in PoolsClient. */ +public interface PoolsClient { + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the machine pool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProject(String resourceGroupName, String projectName); + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProject(String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner get(String resourceGroupName, String projectName, String poolName); + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String projectName, String poolName, Context context); + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PoolInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, String poolName, PoolInner body); + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PoolInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, String poolName, PoolInner body, Context context); + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner createOrUpdate(String resourceGroupName, String projectName, String poolName, PoolInner body); + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner createOrUpdate( + String resourceGroupName, String projectName, String poolName, PoolInner body, Context context); + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PoolInner> beginUpdate( + String resourceGroupName, String projectName, String poolName, PoolUpdate body); + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PoolInner> beginUpdate( + String resourceGroupName, String projectName, String poolName, PoolUpdate body, Context context); + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner update(String resourceGroupName, String projectName, String poolName, PoolUpdate body); + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner update(String resourceGroupName, String projectName, String poolName, PoolUpdate body, Context context); + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String projectName, String poolName); + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String projectName, String poolName, Context context); + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 projectName, String poolName); + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 projectName, String poolName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ProjectEnvironmentTypesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ProjectEnvironmentTypesClient.java new file mode 100644 index 000000000000..74caa4d3eea0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ProjectEnvironmentTypesClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdate; + +/** An instance of this class provides access to all the operations defined in ProjectEnvironmentTypesClient. */ +public interface ProjectEnvironmentTypesClient { + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 result of the project environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String projectName); + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectEnvironmentTypeInner get(String resourceGroupName, String projectName, String environmentTypeName); + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context); + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectEnvironmentTypeInner createOrUpdate( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeInner body); + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String projectName, + String environmentTypeName, + ProjectEnvironmentTypeInner body, + Context context); + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectEnvironmentTypeInner update( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeUpdate body); + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String projectName, + String environmentTypeName, + ProjectEnvironmentTypeUpdate body, + Context context); + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 projectName, String environmentTypeName); + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ProjectsClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ProjectsClient.java new file mode 100644 index 000000000000..c4decaf3fdbd --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/ProjectsClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.ProjectInner; +import com.azure.resourcemanager.devcenter.models.ProjectUpdate; + +/** An instance of this class provides access to all the operations defined in ProjectsClient. */ +public interface ProjectsClient { + /** + * Lists all projects in 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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, Context context); + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner getByResourceGroup(String resourceGroupName, String projectName); + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String projectName, Context context); + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, ProjectInner body); + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, ProjectInner body, Context context); + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner createOrUpdate(String resourceGroupName, String projectName, ProjectInner body); + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner createOrUpdate(String resourceGroupName, String projectName, ProjectInner body, Context context); + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginUpdate( + String resourceGroupName, String projectName, ProjectUpdate body); + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginUpdate( + String resourceGroupName, String projectName, ProjectUpdate body, Context context); + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner update(String resourceGroupName, String projectName, ProjectUpdate body); + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner update(String resourceGroupName, String projectName, ProjectUpdate body, Context context); + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String projectName); + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String projectName, Context context); + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 projectName); + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 projectName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/SchedulesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/SchedulesClient.java new file mode 100644 index 000000000000..6ce311273351 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/SchedulesClient.java @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devcenter.models.ScheduleUpdate; + +/** An instance of this class provides access to all the operations defined in SchedulesClient. */ +public interface SchedulesClient { + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 result of the schedule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPool(String resourceGroupName, String projectName, String poolName); + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPool( + String resourceGroupName, String projectName, String poolName, Integer top, Context context); + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 schedule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner get(String resourceGroupName, String projectName, String poolName, String scheduleName); + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context); + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ScheduleInner> beginCreateOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top); + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ScheduleInner> beginCreateOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + Context context); + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top); + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleInner body); + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + Context context); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 update( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleUpdate body); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 projectName, String poolName, String scheduleName, Integer top); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 projectName, String poolName, String scheduleName); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 projectName, + String poolName, + String scheduleName, + Integer top, + Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/SkusClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/SkusClient.java new file mode 100644 index 000000000000..816b14c2a5dc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/SkusClient.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.devcenter.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.devcenter.fluent.models.DevCenterSkuInner; + +/** An instance of this class provides access to all the operations defined in SkusClient. */ +public interface SkusClient { + /** + * Lists the Microsoft.DevCenter SKUs available in 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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/UsagesClient.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/UsagesClient.java new file mode 100644 index 000000000000..69fb4f4ec0fd --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/UsagesClient.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public interface UsagesClient { + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location); + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/AttachedNetworkConnectionInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/AttachedNetworkConnectionInner.java new file mode 100644 index 000000000000..20bc6a499ec5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/AttachedNetworkConnectionInner.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.DomainJoinType; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents an attached NetworkConnection. */ +@Fluent +public final class AttachedNetworkConnectionInner extends ProxyResource { + /* + * Attached NetworkConnection properties. + */ + @JsonProperty(value = "properties") + private AttachedNetworkConnectionProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Attached NetworkConnection properties. + * + * @return the innerProperties value. + */ + private AttachedNetworkConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the networkConnectionId property: The resource ID of the NetworkConnection you want to attach. + * + * @return the networkConnectionId value. + */ + public String networkConnectionId() { + return this.innerProperties() == null ? null : this.innerProperties().networkConnectionId(); + } + + /** + * Set the networkConnectionId property: The resource ID of the NetworkConnection you want to attach. + * + * @param networkConnectionId the networkConnectionId value to set. + * @return the AttachedNetworkConnectionInner object itself. + */ + public AttachedNetworkConnectionInner withNetworkConnectionId(String networkConnectionId) { + if (this.innerProperties() == null) { + this.innerProperties = new AttachedNetworkConnectionProperties(); + } + this.innerProperties().withNetworkConnectionId(networkConnectionId); + return this; + } + + /** + * Get the networkConnectionLocation property: The geo-location where the NetworkConnection resource specified in + * 'networkConnectionResourceId' property lives. + * + * @return the networkConnectionLocation value. + */ + public String networkConnectionLocation() { + return this.innerProperties() == null ? null : this.innerProperties().networkConnectionLocation(); + } + + /** + * Get the healthCheckStatus property: Health check status values. + * + * @return the healthCheckStatus value. + */ + public HealthCheckStatus healthCheckStatus() { + return this.innerProperties() == null ? null : this.innerProperties().healthCheckStatus(); + } + + /** + * Get the domainJoinType property: AAD Join type of the network. This is populated based on the referenced Network + * Connection. + * + * @return the domainJoinType value. + */ + public DomainJoinType domainJoinType() { + return this.innerProperties() == null ? null : this.innerProperties().domainJoinType(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/AttachedNetworkConnectionProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/AttachedNetworkConnectionProperties.java new file mode 100644 index 000000000000..791d284121d4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/AttachedNetworkConnectionProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devcenter.models.DomainJoinType; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an attached NetworkConnection. */ +@Fluent +public final class AttachedNetworkConnectionProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The resource ID of the NetworkConnection you want to attach. + */ + @JsonProperty(value = "networkConnectionId", required = true) + private String networkConnectionId; + + /* + * The geo-location where the NetworkConnection resource specified in + * 'networkConnectionResourceId' property lives. + */ + @JsonProperty(value = "networkConnectionLocation", access = JsonProperty.Access.WRITE_ONLY) + private String networkConnectionLocation; + + /* + * Health check status values + */ + @JsonProperty(value = "healthCheckStatus", access = JsonProperty.Access.WRITE_ONLY) + private HealthCheckStatus healthCheckStatus; + + /* + * AAD Join type of the network. This is populated based on the referenced + * Network Connection. + */ + @JsonProperty(value = "domainJoinType", access = JsonProperty.Access.WRITE_ONLY) + private DomainJoinType domainJoinType; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the networkConnectionId property: The resource ID of the NetworkConnection you want to attach. + * + * @return the networkConnectionId value. + */ + public String networkConnectionId() { + return this.networkConnectionId; + } + + /** + * Set the networkConnectionId property: The resource ID of the NetworkConnection you want to attach. + * + * @param networkConnectionId the networkConnectionId value to set. + * @return the AttachedNetworkConnectionProperties object itself. + */ + public AttachedNetworkConnectionProperties withNetworkConnectionId(String networkConnectionId) { + this.networkConnectionId = networkConnectionId; + return this; + } + + /** + * Get the networkConnectionLocation property: The geo-location where the NetworkConnection resource specified in + * 'networkConnectionResourceId' property lives. + * + * @return the networkConnectionLocation value. + */ + public String networkConnectionLocation() { + return this.networkConnectionLocation; + } + + /** + * Get the healthCheckStatus property: Health check status values. + * + * @return the healthCheckStatus value. + */ + public HealthCheckStatus healthCheckStatus() { + return this.healthCheckStatus; + } + + /** + * Get the domainJoinType property: AAD Join type of the network. This is populated based on the referenced Network + * Connection. + * + * @return the domainJoinType value. + */ + public DomainJoinType domainJoinType() { + return this.domainJoinType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkConnectionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property networkConnectionId in model AttachedNetworkConnectionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AttachedNetworkConnectionProperties.class); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogInner.java new file mode 100644 index 000000000000..23345ae6ca97 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.GitCatalog; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a catalog. */ +@Fluent +public final class CatalogInner extends ProxyResource { + /* + * Catalog properties. + */ + @JsonProperty(value = "properties") + private CatalogProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Catalog properties. + * + * @return the innerProperties value. + */ + private CatalogProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the lastSyncTime property: When the catalog was last synced. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime lastSyncTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastSyncTime(); + } + + /** + * Get the gitHub property: Properties for a GitHub catalog type. + * + * @return the gitHub value. + */ + public GitCatalog gitHub() { + return this.innerProperties() == null ? null : this.innerProperties().gitHub(); + } + + /** + * Set the gitHub property: Properties for a GitHub catalog type. + * + * @param gitHub the gitHub value to set. + * @return the CatalogInner object itself. + */ + public CatalogInner withGitHub(GitCatalog gitHub) { + if (this.innerProperties() == null) { + this.innerProperties = new CatalogProperties(); + } + this.innerProperties().withGitHub(gitHub); + return this; + } + + /** + * Get the adoGit property: Properties for an Azure DevOps catalog type. + * + * @return the adoGit value. + */ + public GitCatalog adoGit() { + return this.innerProperties() == null ? null : this.innerProperties().adoGit(); + } + + /** + * Set the adoGit property: Properties for an Azure DevOps catalog type. + * + * @param adoGit the adoGit value to set. + * @return the CatalogInner object itself. + */ + public CatalogInner withAdoGit(GitCatalog adoGit) { + if (this.innerProperties() == null) { + this.innerProperties = new CatalogProperties(); + } + this.innerProperties().withAdoGit(adoGit); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogProperties.java new file mode 100644 index 000000000000..f518818a0d1b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogProperties.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.GitCatalog; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a catalog. */ +@Fluent +public final class CatalogProperties extends CatalogUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * When the catalog was last synced. + */ + @JsonProperty(value = "lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastSyncTime; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastSyncTime property: When the catalog was last synced. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime lastSyncTime() { + return this.lastSyncTime; + } + + /** {@inheritDoc} */ + @Override + public CatalogProperties withGitHub(GitCatalog gitHub) { + super.withGitHub(gitHub); + return this; + } + + /** {@inheritDoc} */ + @Override + public CatalogProperties withAdoGit(GitCatalog adoGit) { + super.withAdoGit(adoGit); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogUpdateProperties.java new file mode 100644 index 000000000000..60244e3524ce --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/CatalogUpdateProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.GitCatalog; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a catalog. These properties can be updated after the resource has been created. */ +@Fluent +public class CatalogUpdateProperties { + /* + * Properties for a GitHub catalog type. + */ + @JsonProperty(value = "gitHub") + private GitCatalog gitHub; + + /* + * Properties for an Azure DevOps catalog type. + */ + @JsonProperty(value = "adoGit") + private GitCatalog adoGit; + + /** + * Get the gitHub property: Properties for a GitHub catalog type. + * + * @return the gitHub value. + */ + public GitCatalog gitHub() { + return this.gitHub; + } + + /** + * Set the gitHub property: Properties for a GitHub catalog type. + * + * @param gitHub the gitHub value to set. + * @return the CatalogUpdateProperties object itself. + */ + public CatalogUpdateProperties withGitHub(GitCatalog gitHub) { + this.gitHub = gitHub; + return this; + } + + /** + * Get the adoGit property: Properties for an Azure DevOps catalog type. + * + * @return the adoGit value. + */ + public GitCatalog adoGit() { + return this.adoGit; + } + + /** + * Set the adoGit property: Properties for an Azure DevOps catalog type. + * + * @param adoGit the adoGit value to set. + * @return the CatalogUpdateProperties object itself. + */ + public CatalogUpdateProperties withAdoGit(GitCatalog adoGit) { + this.adoGit = adoGit; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (gitHub() != null) { + gitHub().validate(); + } + if (adoGit() != null) { + adoGit().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionInner.java new file mode 100644 index 000000000000..94d2909f6423 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionInner.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.ImageReference; +import com.azure.resourcemanager.devcenter.models.ImageValidationErrorDetails; +import com.azure.resourcemanager.devcenter.models.ImageValidationStatus; +import com.azure.resourcemanager.devcenter.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a definition for a Developer Machine. */ +@Fluent +public final class DevBoxDefinitionInner extends Resource { + /* + * Dev Box definition properties + */ + @JsonProperty(value = "properties") + private DevBoxDefinitionProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Dev Box definition properties. + * + * @return the innerProperties value. + */ + private DevBoxDefinitionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the imageValidationStatus property: Validation status of the configured image. + * + * @return the imageValidationStatus value. + */ + public ImageValidationStatus imageValidationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().imageValidationStatus(); + } + + /** + * Get the imageValidationErrorDetails property: Details for image validator error. Populated when the image + * validation is not successful. + * + * @return the imageValidationErrorDetails value. + */ + public ImageValidationErrorDetails imageValidationErrorDetails() { + return this.innerProperties() == null ? null : this.innerProperties().imageValidationErrorDetails(); + } + + /** + * Get the activeImageReference property: Image reference information for the currently active image (only populated + * during updates). + * + * @return the activeImageReference value. + */ + public ImageReference activeImageReference() { + return this.innerProperties() == null ? null : this.innerProperties().activeImageReference(); + } + + /** + * Get the imageReference property: Image reference information. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.innerProperties() == null ? null : this.innerProperties().imageReference(); + } + + /** + * Set the imageReference property: Image reference information. + * + * @param imageReference the imageReference value to set. + * @return the DevBoxDefinitionInner object itself. + */ + public DevBoxDefinitionInner withImageReference(ImageReference imageReference) { + if (this.innerProperties() == null) { + this.innerProperties = new DevBoxDefinitionProperties(); + } + this.innerProperties().withImageReference(imageReference); + return this; + } + + /** + * Get the sku property: The SKU for Dev Boxes created using this definition. + * + * @return the sku value. + */ + public Sku sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: The SKU for Dev Boxes created using this definition. + * + * @param sku the sku value to set. + * @return the DevBoxDefinitionInner object itself. + */ + public DevBoxDefinitionInner withSku(Sku sku) { + if (this.innerProperties() == null) { + this.innerProperties = new DevBoxDefinitionProperties(); + } + this.innerProperties().withSku(sku); + return this; + } + + /** + * Get the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @return the osStorageType value. + */ + public String osStorageType() { + return this.innerProperties() == null ? null : this.innerProperties().osStorageType(); + } + + /** + * Set the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @param osStorageType the osStorageType value to set. + * @return the DevBoxDefinitionInner object itself. + */ + public DevBoxDefinitionInner withOsStorageType(String osStorageType) { + if (this.innerProperties() == null) { + this.innerProperties = new DevBoxDefinitionProperties(); + } + this.innerProperties().withOsStorageType(osStorageType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionProperties.java new file mode 100644 index 000000000000..7393c55db870 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionProperties.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.ImageReference; +import com.azure.resourcemanager.devcenter.models.ImageValidationErrorDetails; +import com.azure.resourcemanager.devcenter.models.ImageValidationStatus; +import com.azure.resourcemanager.devcenter.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a Dev Box definition. */ +@Fluent +public final class DevBoxDefinitionProperties extends DevBoxDefinitionUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Validation status of the configured image. + */ + @JsonProperty(value = "imageValidationStatus", access = JsonProperty.Access.WRITE_ONLY) + private ImageValidationStatus imageValidationStatus; + + /* + * Details for image validator error. Populated when the image validation + * is not successful. + */ + @JsonProperty(value = "imageValidationErrorDetails", access = JsonProperty.Access.WRITE_ONLY) + private ImageValidationErrorDetails imageValidationErrorDetails; + + /* + * Image reference information for the currently active image (only + * populated during updates). + */ + @JsonProperty(value = "activeImageReference", access = JsonProperty.Access.WRITE_ONLY) + private ImageReference activeImageReference; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the imageValidationStatus property: Validation status of the configured image. + * + * @return the imageValidationStatus value. + */ + public ImageValidationStatus imageValidationStatus() { + return this.imageValidationStatus; + } + + /** + * Get the imageValidationErrorDetails property: Details for image validator error. Populated when the image + * validation is not successful. + * + * @return the imageValidationErrorDetails value. + */ + public ImageValidationErrorDetails imageValidationErrorDetails() { + return this.imageValidationErrorDetails; + } + + /** + * Get the activeImageReference property: Image reference information for the currently active image (only populated + * during updates). + * + * @return the activeImageReference value. + */ + public ImageReference activeImageReference() { + return this.activeImageReference; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionProperties withImageReference(ImageReference imageReference) { + super.withImageReference(imageReference); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionProperties withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionProperties withOsStorageType(String osStorageType) { + super.withOsStorageType(osStorageType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (imageValidationErrorDetails() != null) { + imageValidationErrorDetails().validate(); + } + if (activeImageReference() != null) { + activeImageReference().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionUpdateProperties.java new file mode 100644 index 000000000000..b4740ff3f1b7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevBoxDefinitionUpdateProperties.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.ImageReference; +import com.azure.resourcemanager.devcenter.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a Dev Box definition. These properties can be updated after the resource has been created. */ +@Fluent +public class DevBoxDefinitionUpdateProperties { + /* + * Image reference information. + */ + @JsonProperty(value = "imageReference") + private ImageReference imageReference; + + /* + * The SKU for Dev Boxes created using this definition. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The storage type used for the Operating System disk of Dev Boxes created + * using this definition. + */ + @JsonProperty(value = "osStorageType") + private String osStorageType; + + /** + * Get the imageReference property: Image reference information. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: Image reference information. + * + * @param imageReference the imageReference value to set. + * @return the DevBoxDefinitionUpdateProperties object itself. + */ + public DevBoxDefinitionUpdateProperties withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the sku property: The SKU for Dev Boxes created using this definition. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU for Dev Boxes created using this definition. + * + * @param sku the sku value to set. + * @return the DevBoxDefinitionUpdateProperties object itself. + */ + public DevBoxDefinitionUpdateProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @return the osStorageType value. + */ + public String osStorageType() { + return this.osStorageType; + } + + /** + * Set the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @param osStorageType the osStorageType value to set. + * @return the DevBoxDefinitionUpdateProperties object itself. + */ + public DevBoxDefinitionUpdateProperties withOsStorageType(String osStorageType) { + this.osStorageType = osStorageType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() != null) { + imageReference().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterInner.java new file mode 100644 index 000000000000..dc7ad235aee9 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterInner.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a devcenter resource. */ +@Fluent +public final class DevCenterInner extends Resource { + /* + * DevCenter properties + */ + @JsonProperty(value = "properties") + private DevCenterProperties innerProperties; + + /* + * Managed identity properties + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /** + * Get the innerProperties property: DevCenter properties. + * + * @return the innerProperties value. + */ + private DevCenterProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: Managed identity properties. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties. + * + * @param identity the identity value to set. + * @return the DevCenterInner object itself. + */ + public DevCenterInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterProperties.java new file mode 100644 index 000000000000..c93b55b9859d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterProperties.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.devcenter.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the devcenter. */ +@Immutable +public final class DevCenterProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterSkuInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterSkuInner.java new file mode 100644 index 000000000000..327a949d4956 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/DevCenterSkuInner.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.Capability; +import com.azure.resourcemanager.devcenter.models.Sku; +import com.azure.resourcemanager.devcenter.models.SkuTier; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The resource model definition representing SKU for DevCenter resources. */ +@Fluent +public final class DevCenterSkuInner extends Sku { + /* + * The name of the resource type + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * SKU supported locations. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * Collection of name/value pairs to describe the SKU capabilities. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private List capabilities; + + /** + * Get the resourceType property: The name of the resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the locations property: SKU supported locations. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the capabilities property: Collection of name/value pairs to describe the SKU capabilities. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** {@inheritDoc} */ + @Override + public DevCenterSkuInner withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterSkuInner withTier(SkuTier tier) { + super.withTier(tier); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterSkuInner withSize(String size) { + super.withSize(size); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterSkuInner withFamily(String family) { + super.withFamily(family); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterSkuInner withCapacity(Integer capacity) { + super.withCapacity(capacity); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/EnvironmentTypeInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/EnvironmentTypeInner.java new file mode 100644 index 000000000000..6d8c8ae7c257 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/EnvironmentTypeInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents an environment type. */ +@Fluent +public final class EnvironmentTypeInner extends ProxyResource { + /* + * Properties of an environment type. + */ + @JsonProperty(value = "properties") + private EnvironmentTypeProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of an environment type. + * + * @return the innerProperties value. + */ + private EnvironmentTypeProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EnvironmentTypeInner object itself. + */ + public EnvironmentTypeInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/EnvironmentTypeProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/EnvironmentTypeProperties.java new file mode 100644 index 000000000000..6ed5a93aeb95 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/EnvironmentTypeProperties.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.devcenter.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an environment type. */ +@Immutable +public final class EnvironmentTypeProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/GalleryInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/GalleryInner.java new file mode 100644 index 000000000000..b640452a72fd --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/GalleryInner.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a gallery. */ +@Fluent +public final class GalleryInner extends ProxyResource { + /* + * Gallery properties. + */ + @JsonProperty(value = "properties") + private GalleryProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Gallery properties. + * + * @return the innerProperties value. + */ + private GalleryProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the galleryResourceId property: The resource ID of the backing Azure Compute Gallery. + * + * @return the galleryResourceId value. + */ + public String galleryResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().galleryResourceId(); + } + + /** + * Set the galleryResourceId property: The resource ID of the backing Azure Compute Gallery. + * + * @param galleryResourceId the galleryResourceId value to set. + * @return the GalleryInner object itself. + */ + public GalleryInner withGalleryResourceId(String galleryResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withGalleryResourceId(galleryResourceId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/GalleryProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/GalleryProperties.java new file mode 100644 index 000000000000..db53560968d4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/GalleryProperties.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a gallery. */ +@Fluent +public final class GalleryProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The resource ID of the backing Azure Compute Gallery. + */ + @JsonProperty(value = "galleryResourceId", required = true) + private String galleryResourceId; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the galleryResourceId property: The resource ID of the backing Azure Compute Gallery. + * + * @return the galleryResourceId value. + */ + public String galleryResourceId() { + return this.galleryResourceId; + } + + /** + * Set the galleryResourceId property: The resource ID of the backing Azure Compute Gallery. + * + * @param galleryResourceId the galleryResourceId value to set. + * @return the GalleryProperties object itself. + */ + public GalleryProperties withGalleryResourceId(String galleryResourceId) { + this.galleryResourceId = galleryResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (galleryResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property galleryResourceId in model GalleryProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GalleryProperties.class); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/HealthCheckStatusDetailsInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/HealthCheckStatusDetailsInner.java new file mode 100644 index 000000000000..4bb29510a03e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/HealthCheckStatusDetailsInner.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.HealthCheck; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Health Check details. */ +@Fluent +public final class HealthCheckStatusDetailsInner extends ProxyResource { + /* + * Health check status details properties. + */ + @JsonProperty(value = "properties") + private HealthCheckStatusDetailsProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Health check status details properties. + * + * @return the innerProperties value. + */ + private HealthCheckStatusDetailsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the startDateTime property: Start time of last execution of the health checks. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().startDateTime(); + } + + /** + * Get the endDateTime property: End time of last execution of the health checks. + * + * @return the endDateTime value. + */ + public OffsetDateTime endDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().endDateTime(); + } + + /** + * Get the healthChecks property: Details for each health check item. + * + * @return the healthChecks value. + */ + public List healthChecks() { + return this.innerProperties() == null ? null : this.innerProperties().healthChecks(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/HealthCheckStatusDetailsProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/HealthCheckStatusDetailsProperties.java new file mode 100644 index 000000000000..10162bbac27d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/HealthCheckStatusDetailsProperties.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.models.HealthCheck; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Health Check properties. */ +@Immutable +public final class HealthCheckStatusDetailsProperties { + /* + * Start time of last execution of the health checks. + */ + @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startDateTime; + + /* + * End time of last execution of the health checks. + */ + @JsonProperty(value = "endDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endDateTime; + + /* + * Details for each health check item. + */ + @JsonProperty(value = "healthChecks", access = JsonProperty.Access.WRITE_ONLY) + private List healthChecks; + + /** + * Get the startDateTime property: Start time of last execution of the health checks. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Get the endDateTime property: End time of last execution of the health checks. + * + * @return the endDateTime value. + */ + public OffsetDateTime endDateTime() { + return this.endDateTime; + } + + /** + * Get the healthChecks property: Details for each health check item. + * + * @return the healthChecks value. + */ + public List healthChecks() { + return this.healthChecks; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (healthChecks() != null) { + healthChecks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageInner.java new file mode 100644 index 000000000000..871d9b736fac --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.devcenter.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents an image. */ +@Fluent +public final class ImageInner extends ProxyResource { + /* + * Image properties. + */ + @JsonProperty(value = "properties") + private ImageProperties innerProperties; + + /** + * Get the innerProperties property: Image properties. + * + * @return the innerProperties value. + */ + private ImageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: The description of the image. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the publisher property: The publisher of the image. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Get the offer property: The name of the image offer. + * + * @return the offer value. + */ + public String offer() { + return this.innerProperties() == null ? null : this.innerProperties().offer(); + } + + /** + * Get the sku property: The SKU name for the image. + * + * @return the sku value. + */ + public String sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Get the recommendedMachineConfiguration property: The recommended machine configuration to use with the image. + * + * @return the recommendedMachineConfiguration value. + */ + public RecommendedMachineConfiguration recommendedMachineConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().recommendedMachineConfiguration(); + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageProperties.java new file mode 100644 index 000000000000..17e63b7e57d2 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an image. */ +@Immutable +public final class ImageProperties { + /* + * The description of the image. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The publisher of the image. + */ + @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /* + * The name of the image offer. + */ + @JsonProperty(value = "offer", access = JsonProperty.Access.WRITE_ONLY) + private String offer; + + /* + * The SKU name for the image. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /* + * The recommended machine configuration to use with the image. + */ + @JsonProperty(value = "recommendedMachineConfiguration", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedMachineConfiguration recommendedMachineConfiguration; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the description property: The description of the image. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the publisher property: The publisher of the image. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the offer property: The name of the image offer. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Get the sku property: The SKU name for the image. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Get the recommendedMachineConfiguration property: The recommended machine configuration to use with the image. + * + * @return the recommendedMachineConfiguration value. + */ + public RecommendedMachineConfiguration recommendedMachineConfiguration() { + return this.recommendedMachineConfiguration; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recommendedMachineConfiguration() != null) { + recommendedMachineConfiguration().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageVersionInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageVersionInner.java new file mode 100644 index 000000000000..e1f002f22c2b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageVersionInner.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents an image version. */ +@Fluent +public final class ImageVersionInner extends ProxyResource { + /* + * Image version properties. + */ + @JsonProperty(value = "properties") + private ImageVersionProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Image version properties. + * + * @return the innerProperties value. + */ + private ImageVersionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the name property: The semantic version string. + * + * @return the name value. + */ + public String namePropertiesName() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Get the publishedDate property: The datetime that the backing image version was published. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.innerProperties() == null ? null : this.innerProperties().publishedDate(); + } + + /** + * Get the excludeFromLatest property: If the version should be excluded from being treated as the latest version. + * + * @return the excludeFromLatest value. + */ + public Boolean excludeFromLatest() { + return this.innerProperties() == null ? null : this.innerProperties().excludeFromLatest(); + } + + /** + * Get the osDiskImageSizeInGb property: The size of the OS disk image, in GB. + * + * @return the osDiskImageSizeInGb value. + */ + public Integer osDiskImageSizeInGb() { + return this.innerProperties() == null ? null : this.innerProperties().osDiskImageSizeInGb(); + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageVersionProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageVersionProperties.java new file mode 100644 index 000000000000..20ce508503b0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ImageVersionProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an image version. */ +@Immutable +public final class ImageVersionProperties { + /* + * The semantic version string. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The datetime that the backing image version was published. + */ + @JsonProperty(value = "publishedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime publishedDate; + + /* + * If the version should be excluded from being treated as the latest + * version. + */ + @JsonProperty(value = "excludeFromLatest", access = JsonProperty.Access.WRITE_ONLY) + private Boolean excludeFromLatest; + + /* + * The size of the OS disk image, in GB. + */ + @JsonProperty(value = "osDiskImageSizeInGb", access = JsonProperty.Access.WRITE_ONLY) + private Integer osDiskImageSizeInGb; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the name property: The semantic version string. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the publishedDate property: The datetime that the backing image version was published. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.publishedDate; + } + + /** + * Get the excludeFromLatest property: If the version should be excluded from being treated as the latest version. + * + * @return the excludeFromLatest value. + */ + public Boolean excludeFromLatest() { + return this.excludeFromLatest; + } + + /** + * Get the osDiskImageSizeInGb property: The size of the OS disk image, in GB. + * + * @return the osDiskImageSizeInGb value. + */ + public Integer osDiskImageSizeInGb() { + return this.osDiskImageSizeInGb; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkConnectionInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkConnectionInner.java new file mode 100644 index 000000000000..fbf6410af444 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkConnectionInner.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.DomainJoinType; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Network related settings. */ +@Fluent +public final class NetworkConnectionInner extends Resource { + /* + * Properties of a Network Connection + */ + @JsonProperty(value = "properties") + private NetworkProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of a Network Connection. + * + * @return the innerProperties value. + */ + private NetworkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public NetworkConnectionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkConnectionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the healthCheckStatus property: Overall health status of the network connection. Health checks are run on + * creation, update, and periodically to validate the network connection. + * + * @return the healthCheckStatus value. + */ + public HealthCheckStatus healthCheckStatus() { + return this.innerProperties() == null ? null : this.innerProperties().healthCheckStatus(); + } + + /** + * Get the networkingResourceGroupName property: The name for resource group where NICs will be placed. + * + * @return the networkingResourceGroupName value. + */ + public String networkingResourceGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().networkingResourceGroupName(); + } + + /** + * Set the networkingResourceGroupName property: The name for resource group where NICs will be placed. + * + * @param networkingResourceGroupName the networkingResourceGroupName value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withNetworkingResourceGroupName(String networkingResourceGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withNetworkingResourceGroupName(networkingResourceGroupName); + return this; + } + + /** + * Get the domainJoinType property: AAD Join type. + * + * @return the domainJoinType value. + */ + public DomainJoinType domainJoinType() { + return this.innerProperties() == null ? null : this.innerProperties().domainJoinType(); + } + + /** + * Set the domainJoinType property: AAD Join type. + * + * @param domainJoinType the domainJoinType value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withDomainJoinType(DomainJoinType domainJoinType) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withDomainJoinType(domainJoinType); + return this; + } + + /** + * Get the subnetId property: The subnet to attach Virtual Machines to. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Set the subnetId property: The subnet to attach Virtual Machines to. + * + * @param subnetId the subnetId value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withSubnetId(String subnetId) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the domainName property: Active Directory domain name. + * + * @return the domainName value. + */ + public String domainName() { + return this.innerProperties() == null ? null : this.innerProperties().domainName(); + } + + /** + * Set the domainName property: Active Directory domain name. + * + * @param domainName the domainName value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withDomainName(String domainName) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withDomainName(domainName); + return this; + } + + /** + * Get the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @return the organizationUnit value. + */ + public String organizationUnit() { + return this.innerProperties() == null ? null : this.innerProperties().organizationUnit(); + } + + /** + * Set the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @param organizationUnit the organizationUnit value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withOrganizationUnit(String organizationUnit) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withOrganizationUnit(organizationUnit); + return this; + } + + /** + * Get the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @return the domainUsername value. + */ + public String domainUsername() { + return this.innerProperties() == null ? null : this.innerProperties().domainUsername(); + } + + /** + * Set the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @param domainUsername the domainUsername value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withDomainUsername(String domainUsername) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withDomainUsername(domainUsername); + return this; + } + + /** + * Get the domainPassword property: The password for the account used to join domain. + * + * @return the domainPassword value. + */ + public String domainPassword() { + return this.innerProperties() == null ? null : this.innerProperties().domainPassword(); + } + + /** + * Set the domainPassword property: The password for the account used to join domain. + * + * @param domainPassword the domainPassword value to set. + * @return the NetworkConnectionInner object itself. + */ + public NetworkConnectionInner withDomainPassword(String domainPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkProperties(); + } + this.innerProperties().withDomainPassword(domainPassword); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkConnectionUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkConnectionUpdateProperties.java new file mode 100644 index 000000000000..c1ad781768a7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkConnectionUpdateProperties.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of network connection. These properties can be updated after the resource has been created. */ +@Fluent +public class NetworkConnectionUpdateProperties { + /* + * The subnet to attach Virtual Machines to + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /* + * Active Directory domain name + */ + @JsonProperty(value = "domainName") + private String domainName; + + /* + * Active Directory domain Organization Unit (OU) + */ + @JsonProperty(value = "organizationUnit") + private String organizationUnit; + + /* + * The username of an Active Directory account (user or service account) + * that has permissions to create computer objects in Active Directory. + * Required format: admin@contoso.com. + */ + @JsonProperty(value = "domainUsername") + private String domainUsername; + + /* + * The password for the account used to join domain + */ + @JsonProperty(value = "domainPassword") + private String domainPassword; + + /** + * Get the subnetId property: The subnet to attach Virtual Machines to. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The subnet to attach Virtual Machines to. + * + * @param subnetId the subnetId value to set. + * @return the NetworkConnectionUpdateProperties object itself. + */ + public NetworkConnectionUpdateProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the domainName property: Active Directory domain name. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Set the domainName property: Active Directory domain name. + * + * @param domainName the domainName value to set. + * @return the NetworkConnectionUpdateProperties object itself. + */ + public NetworkConnectionUpdateProperties withDomainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Get the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @return the organizationUnit value. + */ + public String organizationUnit() { + return this.organizationUnit; + } + + /** + * Set the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @param organizationUnit the organizationUnit value to set. + * @return the NetworkConnectionUpdateProperties object itself. + */ + public NetworkConnectionUpdateProperties withOrganizationUnit(String organizationUnit) { + this.organizationUnit = organizationUnit; + return this; + } + + /** + * Get the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @return the domainUsername value. + */ + public String domainUsername() { + return this.domainUsername; + } + + /** + * Set the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @param domainUsername the domainUsername value to set. + * @return the NetworkConnectionUpdateProperties object itself. + */ + public NetworkConnectionUpdateProperties withDomainUsername(String domainUsername) { + this.domainUsername = domainUsername; + return this; + } + + /** + * Get the domainPassword property: The password for the account used to join domain. + * + * @return the domainPassword value. + */ + public String domainPassword() { + return this.domainPassword; + } + + /** + * Set the domainPassword property: The password for the account used to join domain. + * + * @param domainPassword the domainPassword value to set. + * @return the NetworkConnectionUpdateProperties object itself. + */ + public NetworkConnectionUpdateProperties withDomainPassword(String domainPassword) { + this.domainPassword = domainPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkProperties.java new file mode 100644 index 000000000000..139396195d90 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/NetworkProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devcenter.models.DomainJoinType; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Network properties. */ +@Fluent +public final class NetworkProperties extends NetworkConnectionUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Overall health status of the network connection. Health checks are run + * on creation, update, and periodically to validate the network + * connection. + */ + @JsonProperty(value = "healthCheckStatus", access = JsonProperty.Access.WRITE_ONLY) + private HealthCheckStatus healthCheckStatus; + + /* + * The name for resource group where NICs will be placed. + */ + @JsonProperty(value = "networkingResourceGroupName") + private String networkingResourceGroupName; + + /* + * AAD Join type. + */ + @JsonProperty(value = "domainJoinType", required = true) + private DomainJoinType domainJoinType; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the healthCheckStatus property: Overall health status of the network connection. Health checks are run on + * creation, update, and periodically to validate the network connection. + * + * @return the healthCheckStatus value. + */ + public HealthCheckStatus healthCheckStatus() { + return this.healthCheckStatus; + } + + /** + * Get the networkingResourceGroupName property: The name for resource group where NICs will be placed. + * + * @return the networkingResourceGroupName value. + */ + public String networkingResourceGroupName() { + return this.networkingResourceGroupName; + } + + /** + * Set the networkingResourceGroupName property: The name for resource group where NICs will be placed. + * + * @param networkingResourceGroupName the networkingResourceGroupName value to set. + * @return the NetworkProperties object itself. + */ + public NetworkProperties withNetworkingResourceGroupName(String networkingResourceGroupName) { + this.networkingResourceGroupName = networkingResourceGroupName; + return this; + } + + /** + * Get the domainJoinType property: AAD Join type. + * + * @return the domainJoinType value. + */ + public DomainJoinType domainJoinType() { + return this.domainJoinType; + } + + /** + * Set the domainJoinType property: AAD Join type. + * + * @param domainJoinType the domainJoinType value to set. + * @return the NetworkProperties object itself. + */ + public NetworkProperties withDomainJoinType(DomainJoinType domainJoinType) { + this.domainJoinType = domainJoinType; + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkProperties withSubnetId(String subnetId) { + super.withSubnetId(subnetId); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkProperties withDomainName(String domainName) { + super.withDomainName(domainName); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkProperties withOrganizationUnit(String organizationUnit) { + super.withOrganizationUnit(organizationUnit); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkProperties withDomainUsername(String domainUsername) { + super.withDomainUsername(domainUsername); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkProperties withDomainPassword(String domainPassword) { + super.withDomainPassword(domainPassword); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (domainJoinType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property domainJoinType in model NetworkProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkProperties.class); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/OperationInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/OperationInner.java new file mode 100644 index 000000000000..9f771515adca --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/OperationInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.ActionType; +import com.azure.resourcemanager.devcenter.models.OperationDisplay; +import com.azure.resourcemanager.devcenter.models.Origin; +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 { + /* + * 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/OperationStatusInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/OperationStatusInner.java new file mode 100644 index 000000000000..7c33993b42b0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/OperationStatusInner.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.OperationStatusError; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The current status of an async operation. */ +@Fluent +public final class OperationStatusInner { + /* + * Fully qualified ID for the operation status. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The operation id name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Provisioning state of the resource. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The start time of the operation + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time of the operation + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Percent of the operation that is complete + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Float percentComplete; + + /* + * Custom operation properties, populated only for a successful operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Object properties; + + /* + * Operation Error message + */ + @JsonProperty(value = "error") + private OperationStatusError error; + + /** + * Get the id property: Fully qualified ID for the operation status. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The operation id name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: Provisioning state of the resource. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + public Float percentComplete() { + return this.percentComplete; + } + + /** + * Get the properties property: Custom operation properties, populated only for a successful operation. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Get the error property: Operation Error message. + * + * @return the error value. + */ + public OperationStatusError error() { + return this.error; + } + + /** + * Set the error property: Operation Error message. + * + * @param error the error value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(OperationStatusError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolInner.java new file mode 100644 index 000000000000..1e704d2a2892 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolInner.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.LicenseType; +import com.azure.resourcemanager.devcenter.models.LocalAdminStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A pool of Virtual Machines. */ +@Fluent +public final class PoolInner extends Resource { + /* + * Pool properties + */ + @JsonProperty(value = "properties") + private PoolProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Pool properties. + * + * @return the innerProperties value. + */ + private PoolProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public PoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public PoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @return the devBoxDefinitionName value. + */ + public String devBoxDefinitionName() { + return this.innerProperties() == null ? null : this.innerProperties().devBoxDefinitionName(); + } + + /** + * Set the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @param devBoxDefinitionName the devBoxDefinitionName value to set. + * @return the PoolInner object itself. + */ + public PoolInner withDevBoxDefinitionName(String devBoxDefinitionName) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolProperties(); + } + this.innerProperties().withDevBoxDefinitionName(devBoxDefinitionName); + return this; + } + + /** + * Get the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @return the networkConnectionName value. + */ + public String networkConnectionName() { + return this.innerProperties() == null ? null : this.innerProperties().networkConnectionName(); + } + + /** + * Set the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @param networkConnectionName the networkConnectionName value to set. + * @return the PoolInner object itself. + */ + public PoolInner withNetworkConnectionName(String networkConnectionName) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolProperties(); + } + this.innerProperties().withNetworkConnectionName(networkConnectionName); + return this; + } + + /** + * Get the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @return the licenseType value. + */ + public LicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @param licenseType the licenseType value to set. + * @return the PoolInner object itself. + */ + public PoolInner withLicenseType(LicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @return the localAdministrator value. + */ + public LocalAdminStatus localAdministrator() { + return this.innerProperties() == null ? null : this.innerProperties().localAdministrator(); + } + + /** + * Set the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @param localAdministrator the localAdministrator value to set. + * @return the PoolInner object itself. + */ + public PoolInner withLocalAdministrator(LocalAdminStatus localAdministrator) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolProperties(); + } + this.innerProperties().withLocalAdministrator(localAdministrator); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolProperties.java new file mode 100644 index 000000000000..f15ed39dbd62 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.LicenseType; +import com.azure.resourcemanager.devcenter.models.LocalAdminStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a Pool. */ +@Fluent +public final class PoolProperties extends PoolUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public PoolProperties withDevBoxDefinitionName(String devBoxDefinitionName) { + super.withDevBoxDefinitionName(devBoxDefinitionName); + return this; + } + + /** {@inheritDoc} */ + @Override + public PoolProperties withNetworkConnectionName(String networkConnectionName) { + super.withNetworkConnectionName(networkConnectionName); + return this; + } + + /** {@inheritDoc} */ + @Override + public PoolProperties withLicenseType(LicenseType licenseType) { + super.withLicenseType(licenseType); + return this; + } + + /** {@inheritDoc} */ + @Override + public PoolProperties withLocalAdministrator(LocalAdminStatus localAdministrator) { + super.withLocalAdministrator(localAdministrator); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolUpdateProperties.java new file mode 100644 index 000000000000..5d4ec86f85a5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/PoolUpdateProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.LicenseType; +import com.azure.resourcemanager.devcenter.models.LocalAdminStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a Pool. These properties can be updated after the resource has been created. */ +@Fluent +public class PoolUpdateProperties { + /* + * Name of a Dev Box definition in parent Project of this Pool + */ + @JsonProperty(value = "devBoxDefinitionName") + private String devBoxDefinitionName; + + /* + * Name of a Network Connection in parent Project of this Pool + */ + @JsonProperty(value = "networkConnectionName") + private String networkConnectionName; + + /* + * Specifies the license type indicating the caller has already acquired + * licenses for the Dev Boxes that will be created. + */ + @JsonProperty(value = "licenseType") + private LicenseType licenseType; + + /* + * Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + */ + @JsonProperty(value = "localAdministrator") + private LocalAdminStatus localAdministrator; + + /** + * Get the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @return the devBoxDefinitionName value. + */ + public String devBoxDefinitionName() { + return this.devBoxDefinitionName; + } + + /** + * Set the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @param devBoxDefinitionName the devBoxDefinitionName value to set. + * @return the PoolUpdateProperties object itself. + */ + public PoolUpdateProperties withDevBoxDefinitionName(String devBoxDefinitionName) { + this.devBoxDefinitionName = devBoxDefinitionName; + return this; + } + + /** + * Get the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @return the networkConnectionName value. + */ + public String networkConnectionName() { + return this.networkConnectionName; + } + + /** + * Set the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @param networkConnectionName the networkConnectionName value to set. + * @return the PoolUpdateProperties object itself. + */ + public PoolUpdateProperties withNetworkConnectionName(String networkConnectionName) { + this.networkConnectionName = networkConnectionName; + return this; + } + + /** + * Get the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @return the licenseType value. + */ + public LicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @param licenseType the licenseType value to set. + * @return the PoolUpdateProperties object itself. + */ + public PoolUpdateProperties withLicenseType(LicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @return the localAdministrator value. + */ + public LocalAdminStatus localAdministrator() { + return this.localAdministrator; + } + + /** + * Set the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @param localAdministrator the localAdministrator value to set. + * @return the PoolUpdateProperties object itself. + */ + public PoolUpdateProperties withLocalAdministrator(LocalAdminStatus localAdministrator) { + this.localAdministrator = localAdministrator; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeInner.java new file mode 100644 index 000000000000..c3781d26bf5e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeInner.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents an environment type. */ +@Fluent +public final class ProjectEnvironmentTypeInner extends ProxyResource { + /* + * Properties of an environment type. + */ + @JsonProperty(value = "properties") + private ProjectEnvironmentTypeProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Managed identity properties + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * The geo-location for the environment type + */ + @JsonProperty(value = "location") + private String location; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of an environment type. + * + * @return the innerProperties value. + */ + private ProjectEnvironmentTypeProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: Managed identity properties. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties. + * + * @param identity the identity value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the location property: The geo-location for the environment type. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location for the environment type. + * + * @param location the location value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @return the deploymentTargetId value. + */ + public String deploymentTargetId() { + return this.innerProperties() == null ? null : this.innerProperties().deploymentTargetId(); + } + + /** + * Set the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @param deploymentTargetId the deploymentTargetId value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withDeploymentTargetId(String deploymentTargetId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeProperties(); + } + this.innerProperties().withDeploymentTargetId(deploymentTargetId); + return this; + } + + /** + * Get the status property: Defines whether this Environment Type can be used in this Project. + * + * @return the status value. + */ + public EnableStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Defines whether this Environment Type can be used in this Project. + * + * @param status the status value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withStatus(EnableStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @return the creatorRoleAssignment value. + */ + public ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment() { + return this.innerProperties() == null ? null : this.innerProperties().creatorRoleAssignment(); + } + + /** + * Set the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @param creatorRoleAssignment the creatorRoleAssignment value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeProperties(); + } + this.innerProperties().withCreatorRoleAssignment(creatorRoleAssignment); + return this; + } + + /** + * Get the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @return the userRoleAssignments value. + */ + public Map userRoleAssignments() { + return this.innerProperties() == null ? null : this.innerProperties().userRoleAssignments(); + } + + /** + * Set the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @param userRoleAssignments the userRoleAssignments value to set. + * @return the ProjectEnvironmentTypeInner object itself. + */ + public ProjectEnvironmentTypeInner withUserRoleAssignments( + Map userRoleAssignments) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeProperties(); + } + this.innerProperties().withUserRoleAssignments(userRoleAssignments); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeProperties.java new file mode 100644 index 000000000000..cb3db74f3fae --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeProperties.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Properties of a project environment type. */ +@Fluent +public final class ProjectEnvironmentTypeProperties extends ProjectEnvironmentTypeUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public ProjectEnvironmentTypeProperties withDeploymentTargetId(String deploymentTargetId) { + super.withDeploymentTargetId(deploymentTargetId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProjectEnvironmentTypeProperties withStatus(EnableStatus status) { + super.withStatus(status); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProjectEnvironmentTypeProperties withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment) { + super.withCreatorRoleAssignment(creatorRoleAssignment); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProjectEnvironmentTypeProperties withUserRoleAssignments( + Map userRoleAssignments) { + super.withUserRoleAssignments(userRoleAssignments); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeUpdateProperties.java new file mode 100644 index 000000000000..fd7a7b6659e3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectEnvironmentTypeUpdateProperties.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Properties of a project environment type. These properties can be updated after the resource has been created. */ +@Fluent +public class ProjectEnvironmentTypeUpdateProperties { + /* + * Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + */ + @JsonProperty(value = "deploymentTargetId") + private String deploymentTargetId; + + /* + * Defines whether this Environment Type can be used in this Project. + */ + @JsonProperty(value = "status") + private EnableStatus status; + + /* + * The role definition assigned to the environment creator on backing + * resources. + */ + @JsonProperty(value = "creatorRoleAssignment") + private ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment; + + /* + * Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + */ + @JsonProperty(value = "userRoleAssignments") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userRoleAssignments; + + /** + * Get the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @return the deploymentTargetId value. + */ + public String deploymentTargetId() { + return this.deploymentTargetId; + } + + /** + * Set the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @param deploymentTargetId the deploymentTargetId value to set. + * @return the ProjectEnvironmentTypeUpdateProperties object itself. + */ + public ProjectEnvironmentTypeUpdateProperties withDeploymentTargetId(String deploymentTargetId) { + this.deploymentTargetId = deploymentTargetId; + return this; + } + + /** + * Get the status property: Defines whether this Environment Type can be used in this Project. + * + * @return the status value. + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status property: Defines whether this Environment Type can be used in this Project. + * + * @param status the status value to set. + * @return the ProjectEnvironmentTypeUpdateProperties object itself. + */ + public ProjectEnvironmentTypeUpdateProperties withStatus(EnableStatus status) { + this.status = status; + return this; + } + + /** + * Get the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @return the creatorRoleAssignment value. + */ + public ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment() { + return this.creatorRoleAssignment; + } + + /** + * Set the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @param creatorRoleAssignment the creatorRoleAssignment value to set. + * @return the ProjectEnvironmentTypeUpdateProperties object itself. + */ + public ProjectEnvironmentTypeUpdateProperties withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment) { + this.creatorRoleAssignment = creatorRoleAssignment; + return this; + } + + /** + * Get the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @return the userRoleAssignments value. + */ + public Map userRoleAssignments() { + return this.userRoleAssignments; + } + + /** + * Set the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @param userRoleAssignments the userRoleAssignments value to set. + * @return the ProjectEnvironmentTypeUpdateProperties object itself. + */ + public ProjectEnvironmentTypeUpdateProperties withUserRoleAssignments( + Map userRoleAssignments) { + this.userRoleAssignments = userRoleAssignments; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (creatorRoleAssignment() != null) { + creatorRoleAssignment().validate(); + } + if (userRoleAssignments() != null) { + userRoleAssignments() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectInner.java new file mode 100644 index 000000000000..327041d6e1ad --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectInner.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a project resource. */ +@Fluent +public final class ProjectInner extends Resource { + /* + * Properties of a project. + */ + @JsonProperty(value = "properties") + private ProjectProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of a project. + * + * @return the innerProperties value. + */ + private ProjectProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ProjectInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProjectInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the devCenterId property: Resource Id of an associated DevCenter. + * + * @return the devCenterId value. + */ + public String devCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().devCenterId(); + } + + /** + * Set the devCenterId property: Resource Id of an associated DevCenter. + * + * @param devCenterId the devCenterId value to set. + * @return the ProjectInner object itself. + */ + public ProjectInner withDevCenterId(String devCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectProperties(); + } + this.innerProperties().withDevCenterId(devCenterId); + return this; + } + + /** + * Get the description property: Description of the project. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the project. + * + * @param description the description value to set. + * @return the ProjectInner object itself. + */ + public ProjectInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectProperties.java new file mode 100644 index 000000000000..e2d29fef1daa --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectProperties.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.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a project. */ +@Fluent +public final class ProjectProperties extends ProjectUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public ProjectProperties withDevCenterId(String devCenterId) { + super.withDevCenterId(devCenterId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProjectProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectUpdateProperties.java new file mode 100644 index 000000000000..1b3ca765c95d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ProjectUpdateProperties.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a project. These properties can be updated after the resource has been created. */ +@Fluent +public class ProjectUpdateProperties { + /* + * Resource Id of an associated DevCenter + */ + @JsonProperty(value = "devCenterId") + private String devCenterId; + + /* + * Description of the project. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the devCenterId property: Resource Id of an associated DevCenter. + * + * @return the devCenterId value. + */ + public String devCenterId() { + return this.devCenterId; + } + + /** + * Set the devCenterId property: Resource Id of an associated DevCenter. + * + * @param devCenterId the devCenterId value to set. + * @return the ProjectUpdateProperties object itself. + */ + public ProjectUpdateProperties withDevCenterId(String devCenterId) { + this.devCenterId = devCenterId; + return this; + } + + /** + * Get the description property: Description of the project. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the project. + * + * @param description the description value to set. + * @return the ProjectUpdateProperties object itself. + */ + public ProjectUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleInner.java new file mode 100644 index 000000000000..7cfee9241175 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ScheduledFrequency; +import com.azure.resourcemanager.devcenter.models.ScheduledType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a Schedule to execute a task. */ +@Fluent +public final class ScheduleInner extends ProxyResource { + /* + * Properties of a Schedule resource + */ + @JsonProperty(value = "properties") + private ScheduleProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Properties of a Schedule resource. + * + * @return the innerProperties value. + */ + private ScheduleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the type property: Supported type this scheduled task represents. + * + * @return the type value. + */ + public ScheduledType typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Supported type this scheduled task represents. + * + * @param type the type value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTypePropertiesType(ScheduledType type) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the frequency property: The frequency of this scheduled task. + * + * @return the frequency value. + */ + public ScheduledFrequency frequency() { + return this.innerProperties() == null ? null : this.innerProperties().frequency(); + } + + /** + * Set the frequency property: The frequency of this scheduled task. + * + * @param frequency the frequency value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withFrequency(ScheduledFrequency frequency) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleProperties(); + } + this.innerProperties().withFrequency(frequency); + return this; + } + + /** + * Get the time property: The target time to trigger the action. The format is HH:MM. + * + * @return the time value. + */ + public String time() { + return this.innerProperties() == null ? null : this.innerProperties().time(); + } + + /** + * Set the time property: The target time to trigger the action. The format is HH:MM. + * + * @param time the time value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTime(String time) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleProperties(); + } + this.innerProperties().withTime(time); + return this; + } + + /** + * Get the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.innerProperties() == null ? null : this.innerProperties().timeZone(); + } + + /** + * Set the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @param timeZone the timeZone value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTimeZone(String timeZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleProperties(); + } + this.innerProperties().withTimeZone(timeZone); + return this; + } + + /** + * Get the state property: Indicates whether or not this scheduled task is enabled. + * + * @return the state value. + */ + public EnableStatus state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Indicates whether or not this scheduled task is enabled. + * + * @param state the state value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withState(EnableStatus state) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleProperties.java new file mode 100644 index 000000000000..5dbd201a9b27 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ScheduledFrequency; +import com.azure.resourcemanager.devcenter.models.ScheduledType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Schedule properties defining when and what to execute. */ +@Fluent +public final class ScheduleProperties extends ScheduleUpdateProperties { + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public ScheduleProperties withType(ScheduledType type) { + super.withType(type); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduleProperties withFrequency(ScheduledFrequency frequency) { + super.withFrequency(frequency); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduleProperties withTime(String time) { + super.withTime(time); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduleProperties withTimeZone(String timeZone) { + super.withTimeZone(timeZone); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduleProperties withState(EnableStatus state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleUpdateProperties.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleUpdateProperties.java new file mode 100644 index 000000000000..856269edf5cf --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/ScheduleUpdateProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ScheduledFrequency; +import com.azure.resourcemanager.devcenter.models.ScheduledType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Updatable properties of a Schedule. */ +@Fluent +public class ScheduleUpdateProperties { + /* + * Supported type this scheduled task represents. + */ + @JsonProperty(value = "type") + private ScheduledType type; + + /* + * The frequency of this scheduled task. + */ + @JsonProperty(value = "frequency") + private ScheduledFrequency frequency; + + /* + * The target time to trigger the action. The format is HH:MM. + */ + @JsonProperty(value = "time") + private String time; + + /* + * The IANA timezone id at which the schedule should execute. + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /* + * Indicates whether or not this scheduled task is enabled. + */ + @JsonProperty(value = "state") + private EnableStatus state; + + /** + * Get the type property: Supported type this scheduled task represents. + * + * @return the type value. + */ + public ScheduledType type() { + return this.type; + } + + /** + * Set the type property: Supported type this scheduled task represents. + * + * @param type the type value to set. + * @return the ScheduleUpdateProperties object itself. + */ + public ScheduleUpdateProperties withType(ScheduledType type) { + this.type = type; + return this; + } + + /** + * Get the frequency property: The frequency of this scheduled task. + * + * @return the frequency value. + */ + public ScheduledFrequency frequency() { + return this.frequency; + } + + /** + * Set the frequency property: The frequency of this scheduled task. + * + * @param frequency the frequency value to set. + * @return the ScheduleUpdateProperties object itself. + */ + public ScheduleUpdateProperties withFrequency(ScheduledFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the time property: The target time to trigger the action. The format is HH:MM. + * + * @return the time value. + */ + public String time() { + return this.time; + } + + /** + * Set the time property: The target time to trigger the action. The format is HH:MM. + * + * @param time the time value to set. + * @return the ScheduleUpdateProperties object itself. + */ + public ScheduleUpdateProperties withTime(String time) { + this.time = time; + return this; + } + + /** + * Get the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @param timeZone the timeZone value to set. + * @return the ScheduleUpdateProperties object itself. + */ + public ScheduleUpdateProperties withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the state property: Indicates whether or not this scheduled task is enabled. + * + * @return the state value. + */ + public EnableStatus state() { + return this.state; + } + + /** + * Set the state property: Indicates whether or not this scheduled task is enabled. + * + * @param state the state value to set. + * @return the ScheduleUpdateProperties object itself. + */ + public ScheduleUpdateProperties withState(EnableStatus state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/UsageInner.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/UsageInner.java new file mode 100644 index 000000000000..281bb39c611d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/UsageInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.models.UsageName; +import com.azure.resourcemanager.devcenter.models.UsageUnit; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The core usage details. */ +@Fluent +public final class UsageInner { + /* + * The current usage. + */ + @JsonProperty(value = "currentValue") + private Long currentValue; + + /* + * The limit integer. + */ + @JsonProperty(value = "limit") + private Long limit; + + /* + * The unit details. + */ + @JsonProperty(value = "unit") + private UsageUnit unit; + + /* + * The name. + */ + @JsonProperty(value = "name") + private UsageName name; + + /** + * Get the currentValue property: The current usage. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: The current usage. + * + * @param currentValue the currentValue value to set. + * @return the UsageInner object itself. + */ + public UsageInner withCurrentValue(Long currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the limit property: The limit integer. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Set the limit property: The limit integer. + * + * @param limit the limit value to set. + * @return the UsageInner object itself. + */ + public UsageInner withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Get the unit property: The unit details. + * + * @return the unit value. + */ + public UsageUnit unit() { + return this.unit; + } + + /** + * Set the unit property: The unit details. + * + * @param unit the unit value to set. + * @return the UsageInner object itself. + */ + public UsageInner withUnit(UsageUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get the name property: The name. + * + * @return the name value. + */ + public UsageName name() { + return this.name; + } + + /** + * Set the name property: The name. + * + * @param name the name value to set. + * @return the UsageInner object itself. + */ + public UsageInner withName(UsageName name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/package-info.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/models/package-info.java new file mode 100644 index 000000000000..4e629ec79ef3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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 DevCenterClient. DevCenter Management API. */ +package com.azure.resourcemanager.devcenter.fluent.models; diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/package-info.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/fluent/package-info.java new file mode 100644 index 000000000000..ddcd96295f43 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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 DevCenterClient. DevCenter Management API. */ +package com.azure.resourcemanager.devcenter.fluent; diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworkConnectionImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworkConnectionImpl.java new file mode 100644 index 000000000000..6eeb159522c2 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworkConnectionImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.AttachedNetworkConnection; +import com.azure.resourcemanager.devcenter.models.DomainJoinType; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatus; + +public final class AttachedNetworkConnectionImpl + implements AttachedNetworkConnection, AttachedNetworkConnection.Definition, AttachedNetworkConnection.Update { + private AttachedNetworkConnectionInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String networkConnectionId() { + return this.innerModel().networkConnectionId(); + } + + public String networkConnectionLocation() { + return this.innerModel().networkConnectionLocation(); + } + + public HealthCheckStatus healthCheckStatus() { + return this.innerModel().healthCheckStatus(); + } + + public DomainJoinType domainJoinType() { + return this.innerModel().domainJoinType(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AttachedNetworkConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String devCenterName; + + private String attachedNetworkConnectionName; + + public AttachedNetworkConnectionImpl withExistingDevcenter(String resourceGroupName, String devCenterName) { + this.resourceGroupName = resourceGroupName; + this.devCenterName = devCenterName; + return this; + } + + public AttachedNetworkConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getAttachedNetworks() + .createOrUpdate( + resourceGroupName, devCenterName, attachedNetworkConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public AttachedNetworkConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttachedNetworks() + .createOrUpdate( + resourceGroupName, devCenterName, attachedNetworkConnectionName, this.innerModel(), context); + return this; + } + + AttachedNetworkConnectionImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new AttachedNetworkConnectionInner(); + this.serviceManager = serviceManager; + this.attachedNetworkConnectionName = name; + } + + public AttachedNetworkConnectionImpl update() { + return this; + } + + public AttachedNetworkConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAttachedNetworks() + .createOrUpdate( + resourceGroupName, devCenterName, attachedNetworkConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public AttachedNetworkConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttachedNetworks() + .createOrUpdate( + resourceGroupName, devCenterName, attachedNetworkConnectionName, this.innerModel(), context); + return this; + } + + AttachedNetworkConnectionImpl( + AttachedNetworkConnectionInner innerObject, + com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.devCenterName = Utils.getValueFromIdByName(innerObject.id(), "devcenters"); + this.attachedNetworkConnectionName = Utils.getValueFromIdByName(innerObject.id(), "attachednetworks"); + } + + public AttachedNetworkConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAttachedNetworks() + .getByDevCenterWithResponse( + resourceGroupName, devCenterName, attachedNetworkConnectionName, Context.NONE) + .getValue(); + return this; + } + + public AttachedNetworkConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttachedNetworks() + .getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName, context) + .getValue(); + return this; + } + + public AttachedNetworkConnectionImpl withNetworkConnectionId(String networkConnectionId) { + this.innerModel().withNetworkConnectionId(networkConnectionId); + return this; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworksClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworksClientImpl.java new file mode 100644 index 000000000000..73db4590623e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworksClientImpl.java @@ -0,0 +1,1680 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.AttachedNetworksClient; +import com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.AttachedNetworkListResult; +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 AttachedNetworksClient. */ +public final class AttachedNetworksClientImpl implements AttachedNetworksClient { + /** The proxy service used to perform REST calls. */ + private final AttachedNetworksService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of AttachedNetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AttachedNetworksClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(AttachedNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientAttachedNetworks to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientAttac") + private interface AttachedNetworksService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/attachednetworks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/attachednetworks/{attachedNetworkConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByProject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("attachedNetworkConnectionName") String attachedNetworkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/attachednetworks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/attachednetworks/{attachedNetworkConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("attachedNetworkConnectionName") String attachedNetworkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/attachednetworks/{attachedNetworkConnectionName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("attachedNetworkConnectionName") String attachedNetworkConnectionName, + @BodyParam("application/json") AttachedNetworkConnectionInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/attachednetworks/{attachedNetworkConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("attachedNetworkConnectionName") String attachedNetworkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProjectNext( + @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> listByDevCenterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectSinglePageAsync( + String resourceGroupName, String projectName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + 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 attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectSinglePageAsync( + String resourceGroupName, String projectName, Integer top, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync( + String resourceGroupName, String projectName, Integer top) { + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listByProjectNextSinglePageAsync(nextLink)); + } + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listByProjectNextSinglePageAsync(nextLink)); + } + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top, context), + nextLink -> listByProjectNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProject(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedIterable<>(listByProjectAsync(resourceGroupName, projectName, top)); + } + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedIterable<>(listByProjectAsync(resourceGroupName, projectName, top, context)); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByProjectWithResponseAsync( + String resourceGroupName, String projectName, String attachedNetworkConnectionName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + attachedNetworkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByProjectWithResponseAsync( + String resourceGroupName, String projectName, String attachedNetworkConnectionName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + attachedNetworkConnectionName, + accept, + context); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByProjectAsync( + String resourceGroupName, String projectName, String attachedNetworkConnectionName) { + return getByProjectWithResponseAsync(resourceGroupName, projectName, attachedNetworkConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttachedNetworkConnectionInner getByProject( + String resourceGroupName, String projectName, String attachedNetworkConnectionName) { + return getByProjectAsync(resourceGroupName, projectName, attachedNetworkConnectionName).block(); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByProjectWithResponse( + String resourceGroupName, String projectName, String attachedNetworkConnectionName, Context context) { + return getByProjectWithResponseAsync(resourceGroupName, projectName, attachedNetworkConnectionName, context) + .block(); + } + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + 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 attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top, context), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top)); + } + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top, context)); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByDevCenterWithResponseAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + attachedNetworkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByDevCenterWithResponseAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + attachedNetworkConnectionName, + accept, + context); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByDevCenterAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + return getByDevCenterWithResponseAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttachedNetworkConnectionInner getByDevCenter( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + return getByDevCenterAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName).block(); + } + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByDevCenterWithResponse( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context) { + return getByDevCenterWithResponseAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, context) + .block(); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + attachedNetworkConnectionName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + attachedNetworkConnectionName, + body, + accept, + context); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AttachedNetworkConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AttachedNetworkConnectionInner.class, + AttachedNetworkConnectionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AttachedNetworkConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, devCenterName, attachedNetworkConnectionName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AttachedNetworkConnectionInner.class, + AttachedNetworkConnectionInner.class, + context); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AttachedNetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body) + .getSyncPoller(); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AttachedNetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body, context) + .getSyncPoller(); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttachedNetworkConnectionInner createOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body) { + return createOrUpdateAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body).block(); + } + + /** + * Creates or updates an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param body Represents an attached NetworkConnection. + * @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 represents an attached NetworkConnection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttachedNetworkConnectionInner createOrUpdate( + String resourceGroupName, + String devCenterName, + String attachedNetworkConnectionName, + AttachedNetworkConnectionInner body, + Context context) { + return createOrUpdateAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, body, context) + .block(); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + attachedNetworkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (attachedNetworkConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter attachedNetworkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + attachedNetworkConnectionName, + accept, + context); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + return beginDeleteAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName).getSyncPoller(); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, context) + .getSyncPoller(); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + return beginDeleteAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 devCenterName, String attachedNetworkConnectionName) { + deleteAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName).block(); + } + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 devCenterName, String attachedNetworkConnectionName, Context context) { + deleteAsync(resourceGroupName, devCenterName, attachedNetworkConnectionName, 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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectNextSinglePageAsync(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.listByProjectNext(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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectNextSinglePageAsync( + 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 + .listByProjectNext(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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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.listByDevCenterNext(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 results of the Attached Networks list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync( + 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 + .listByDevCenterNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworksImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworksImpl.java new file mode 100644 index 000000000000..b313aed2d0c6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/AttachedNetworksImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.AttachedNetworksClient; +import com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.AttachedNetworkConnection; +import com.azure.resourcemanager.devcenter.models.AttachedNetworks; + +public final class AttachedNetworksImpl implements AttachedNetworks { + private static final ClientLogger LOGGER = new ClientLogger(AttachedNetworksImpl.class); + + private final AttachedNetworksClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public AttachedNetworksImpl( + AttachedNetworksClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByProject(String resourceGroupName, String projectName) { + PagedIterable inner = + this.serviceClient().listByProject(resourceGroupName, projectName); + return Utils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByProject(resourceGroupName, projectName, top, context); + return Utils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager())); + } + + public AttachedNetworkConnection getByProject( + String resourceGroupName, String projectName, String attachedNetworkConnectionName) { + AttachedNetworkConnectionInner inner = + this.serviceClient().getByProject(resourceGroupName, projectName, attachedNetworkConnectionName); + if (inner != null) { + return new AttachedNetworkConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByProjectWithResponse( + String resourceGroupName, String projectName, String attachedNetworkConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getByProjectWithResponse(resourceGroupName, projectName, attachedNetworkConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttachedNetworkConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName); + return Utils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context); + return Utils.mapPage(inner, inner1 -> new AttachedNetworkConnectionImpl(inner1, this.manager())); + } + + public AttachedNetworkConnection getByDevCenter( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + AttachedNetworkConnectionInner inner = + this.serviceClient().getByDevCenter(resourceGroupName, devCenterName, attachedNetworkConnectionName); + if (inner != null) { + return new AttachedNetworkConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByDevCenterWithResponse( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttachedNetworkConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String devCenterName, String attachedNetworkConnectionName) { + this.serviceClient().delete(resourceGroupName, devCenterName, attachedNetworkConnectionName); + } + + public void delete( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, devCenterName, attachedNetworkConnectionName, context); + } + + public AttachedNetworkConnection 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String attachedNetworkConnectionName = Utils.getValueFromIdByName(id, "attachednetworks"); + if (attachedNetworkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id))); + } + return this + .getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String attachedNetworkConnectionName = Utils.getValueFromIdByName(id, "attachednetworks"); + if (attachedNetworkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id))); + } + return this + .getByDevCenterWithResponse(resourceGroupName, devCenterName, attachedNetworkConnectionName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String attachedNetworkConnectionName = Utils.getValueFromIdByName(id, "attachednetworks"); + if (attachedNetworkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id))); + } + this.delete(resourceGroupName, devCenterName, attachedNetworkConnectionName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String attachedNetworkConnectionName = Utils.getValueFromIdByName(id, "attachednetworks"); + if (attachedNetworkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attachednetworks'.", id))); + } + this.delete(resourceGroupName, devCenterName, attachedNetworkConnectionName, context); + } + + private AttachedNetworksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public AttachedNetworkConnectionImpl define(String name) { + return new AttachedNetworkConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogImpl.java new file mode 100644 index 000000000000..551e2d4be484 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.CatalogInner; +import com.azure.resourcemanager.devcenter.models.Catalog; +import com.azure.resourcemanager.devcenter.models.CatalogUpdate; +import com.azure.resourcemanager.devcenter.models.GitCatalog; +import java.time.OffsetDateTime; +import java.util.Map; + +public final class CatalogImpl implements Catalog, Catalog.Definition, Catalog.Update { + private CatalogInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime lastSyncTime() { + return this.innerModel().lastSyncTime(); + } + + public GitCatalog gitHub() { + return this.innerModel().gitHub(); + } + + public GitCatalog adoGit() { + return this.innerModel().adoGit(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CatalogInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String devCenterName; + + private String catalogName; + + private CatalogUpdate updateBody; + + public CatalogImpl withExistingDevcenter(String resourceGroupName, String devCenterName) { + this.resourceGroupName = resourceGroupName; + this.devCenterName = devCenterName; + return this; + } + + public Catalog create() { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .createOrUpdate(resourceGroupName, devCenterName, catalogName, this.innerModel(), Context.NONE); + return this; + } + + public Catalog create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .createOrUpdate(resourceGroupName, devCenterName, catalogName, this.innerModel(), context); + return this; + } + + CatalogImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new CatalogInner(); + this.serviceManager = serviceManager; + this.catalogName = name; + } + + public CatalogImpl update() { + this.updateBody = new CatalogUpdate(); + return this; + } + + public Catalog apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .update(resourceGroupName, devCenterName, catalogName, updateBody, Context.NONE); + return this; + } + + public Catalog apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .update(resourceGroupName, devCenterName, catalogName, updateBody, context); + return this; + } + + CatalogImpl(CatalogInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.devCenterName = Utils.getValueFromIdByName(innerObject.id(), "devcenters"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + } + + public Catalog refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .getWithResponse(resourceGroupName, devCenterName, catalogName, Context.NONE) + .getValue(); + return this; + } + + public Catalog refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .getWithResponse(resourceGroupName, devCenterName, catalogName, context) + .getValue(); + return this; + } + + public void sync() { + serviceManager.catalogs().sync(resourceGroupName, devCenterName, catalogName); + } + + public void sync(Context context) { + serviceManager.catalogs().sync(resourceGroupName, devCenterName, catalogName, context); + } + + public CatalogImpl withGitHub(GitCatalog gitHub) { + if (isInCreateMode()) { + this.innerModel().withGitHub(gitHub); + return this; + } else { + this.updateBody.withGitHub(gitHub); + return this; + } + } + + public CatalogImpl withAdoGit(GitCatalog adoGit) { + if (isInCreateMode()) { + this.innerModel().withAdoGit(adoGit); + return this; + } else { + this.updateBody.withAdoGit(adoGit); + return this; + } + } + + public CatalogImpl withTags(Map tags) { + this.updateBody.withTags(tags); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogsClientImpl.java new file mode 100644 index 000000000000..8c059b3bb2a7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogsClientImpl.java @@ -0,0 +1,1677 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.CatalogsClient; +import com.azure.resourcemanager.devcenter.fluent.models.CatalogInner; +import com.azure.resourcemanager.devcenter.models.CatalogListResult; +import com.azure.resourcemanager.devcenter.models.CatalogUpdate; +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 CatalogsClient. */ +public final class CatalogsClientImpl implements CatalogsClient { + /** The proxy service used to perform REST calls. */ + private final CatalogsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of CatalogsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CatalogsClientImpl(DevCenterClientImpl client) { + this.service = RestProxy.create(CatalogsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientCatalogs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientCatal") + private interface CatalogsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/catalogs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/catalogs/{catalogName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/catalogs/{catalogName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("catalogName") String catalogName, + @BodyParam("application/json") CatalogInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/catalogs/{catalogName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("catalogName") String catalogName, + @BodyParam("application/json") CatalogUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/catalogs/{catalogName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/catalogs/{catalogName}/sync") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> sync( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + 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 catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName, Integer top) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top, context), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top)); + } + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top, context)); + } + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + accept, + context); + } + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String devCenterName, String catalogName) { + return getWithResponseAsync(resourceGroupName, devCenterName, catalogName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner get(String resourceGroupName, String devCenterName, String catalogName) { + return getAsync(resourceGroupName, devCenterName, catalogName).block(); + } + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + return getWithResponseAsync(resourceGroupName, devCenterName, catalogName, context).block(); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + body, + accept, + context); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CatalogInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, catalogName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CatalogInner.class, CatalogInner.class, this.client.getContext()); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CatalogInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, catalogName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CatalogInner.class, CatalogInner.class, context); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, catalogName, body).getSyncPoller(); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, catalogName, body, context).getSyncPoller(); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, catalogName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, catalogName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner createOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body) { + return createOrUpdateAsync(resourceGroupName, devCenterName, catalogName, body).block(); + } + + /** + * Creates or updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Represents a catalog. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner createOrUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, devCenterName, catalogName, body, context).block(); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + body, + accept, + context); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CatalogInner> beginUpdateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, devCenterName, catalogName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CatalogInner.class, CatalogInner.class, this.client.getContext()); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CatalogInner> beginUpdateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, devCenterName, catalogName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CatalogInner.class, CatalogInner.class, context); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CatalogInner> beginUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body) { + return beginUpdateAsync(resourceGroupName, devCenterName, catalogName, body).getSyncPoller(); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CatalogInner> beginUpdate( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, devCenterName, catalogName, body, context).getSyncPoller(); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body) { + return beginUpdateAsync(resourceGroupName, devCenterName, catalogName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, devCenterName, catalogName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner update(String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body) { + return updateAsync(resourceGroupName, devCenterName, catalogName, body).block(); + } + + /** + * Partially updates a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param body Updatable catalog properties. + * @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 represents a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner update( + String resourceGroupName, String devCenterName, String catalogName, CatalogUpdate body, Context context) { + return updateAsync(resourceGroupName, devCenterName, catalogName, body, context).block(); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + accept, + context); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String catalogName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, devCenterName, catalogName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, devCenterName, catalogName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String catalogName) { + return beginDeleteAsync(resourceGroupName, devCenterName, catalogName).getSyncPoller(); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, catalogName, context).getSyncPoller(); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String devCenterName, String catalogName) { + return beginDeleteAsync(resourceGroupName, devCenterName, catalogName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, catalogName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 devCenterName, String catalogName) { + deleteAsync(resourceGroupName, devCenterName, catalogName).block(); + } + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 devCenterName, String catalogName, Context context) { + deleteAsync(resourceGroupName, devCenterName, catalogName, context).block(); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> syncWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .sync( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> syncWithResponseAsync( + String resourceGroupName, String devCenterName, String catalogName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .sync( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + catalogName, + accept, + context); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSyncAsync( + String resourceGroupName, String devCenterName, String catalogName) { + Mono>> mono = syncWithResponseAsync(resourceGroupName, devCenterName, catalogName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSyncAsync( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + syncWithResponseAsync(resourceGroupName, devCenterName, catalogName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSync( + String resourceGroupName, String devCenterName, String catalogName) { + return beginSyncAsync(resourceGroupName, devCenterName, catalogName).getSyncPoller(); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSync( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + return beginSyncAsync(resourceGroupName, devCenterName, catalogName, context).getSyncPoller(); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono syncAsync(String resourceGroupName, String devCenterName, String catalogName) { + return beginSyncAsync(resourceGroupName, devCenterName, catalogName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono syncAsync(String resourceGroupName, String devCenterName, String catalogName, Context context) { + return beginSyncAsync(resourceGroupName, devCenterName, catalogName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 sync(String resourceGroupName, String devCenterName, String catalogName) { + syncAsync(resourceGroupName, devCenterName, catalogName).block(); + } + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 sync(String resourceGroupName, String devCenterName, String catalogName, Context context) { + syncAsync(resourceGroupName, devCenterName, catalogName, 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 results of the catalog list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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.listByDevCenterNext(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 results of the catalog list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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 + .listByDevCenterNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogsImpl.java new file mode 100644 index 000000000000..b4a08b175448 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/CatalogsImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.CatalogsClient; +import com.azure.resourcemanager.devcenter.fluent.models.CatalogInner; +import com.azure.resourcemanager.devcenter.models.Catalog; +import com.azure.resourcemanager.devcenter.models.Catalogs; + +public final class CatalogsImpl implements Catalogs { + private static final ClientLogger LOGGER = new ClientLogger(CatalogsImpl.class); + + private final CatalogsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public CatalogsImpl( + CatalogsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + PagedIterable inner = this.serviceClient().listByDevCenter(resourceGroupName, devCenterName); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public Catalog get(String resourceGroupName, String devCenterName, String catalogName) { + CatalogInner inner = this.serviceClient().get(resourceGroupName, devCenterName, catalogName); + if (inner != null) { + return new CatalogImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String devCenterName, String catalogName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, devCenterName, catalogName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CatalogImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String devCenterName, String catalogName) { + this.serviceClient().delete(resourceGroupName, devCenterName, catalogName); + } + + public void delete(String resourceGroupName, String devCenterName, String catalogName, Context context) { + this.serviceClient().delete(resourceGroupName, devCenterName, catalogName, context); + } + + public void sync(String resourceGroupName, String devCenterName, String catalogName) { + this.serviceClient().sync(resourceGroupName, devCenterName, catalogName); + } + + public void sync(String resourceGroupName, String devCenterName, String catalogName, Context context) { + this.serviceClient().sync(resourceGroupName, devCenterName, catalogName, context); + } + + public Catalog 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, catalogName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, catalogName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + this.delete(resourceGroupName, devCenterName, catalogName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + this.delete(resourceGroupName, devCenterName, catalogName, context); + } + + private CatalogsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public CatalogImpl define(String name) { + return new CatalogImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionImpl.java new file mode 100644 index 000000000000..7042f6a4c886 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionInner; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinition; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinitionUpdate; +import com.azure.resourcemanager.devcenter.models.ImageReference; +import com.azure.resourcemanager.devcenter.models.ImageValidationErrorDetails; +import com.azure.resourcemanager.devcenter.models.ImageValidationStatus; +import com.azure.resourcemanager.devcenter.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class DevBoxDefinitionImpl + implements DevBoxDefinition, DevBoxDefinition.Definition, DevBoxDefinition.Update { + private DevBoxDefinitionInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager 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 provisioningState() { + return this.innerModel().provisioningState(); + } + + public ImageValidationStatus imageValidationStatus() { + return this.innerModel().imageValidationStatus(); + } + + public ImageValidationErrorDetails imageValidationErrorDetails() { + return this.innerModel().imageValidationErrorDetails(); + } + + public ImageReference activeImageReference() { + return this.innerModel().activeImageReference(); + } + + public ImageReference imageReference() { + return this.innerModel().imageReference(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public String osStorageType() { + return this.innerModel().osStorageType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DevBoxDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String devCenterName; + + private String devBoxDefinitionName; + + private DevBoxDefinitionUpdate updateBody; + + public DevBoxDefinitionImpl withExistingDevcenter(String resourceGroupName, String devCenterName) { + this.resourceGroupName = resourceGroupName; + this.devCenterName = devCenterName; + return this; + } + + public DevBoxDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getDevBoxDefinitions() + .createOrUpdate( + resourceGroupName, devCenterName, devBoxDefinitionName, this.innerModel(), Context.NONE); + return this; + } + + public DevBoxDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevBoxDefinitions() + .createOrUpdate(resourceGroupName, devCenterName, devBoxDefinitionName, this.innerModel(), context); + return this; + } + + DevBoxDefinitionImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new DevBoxDefinitionInner(); + this.serviceManager = serviceManager; + this.devBoxDefinitionName = name; + } + + public DevBoxDefinitionImpl update() { + this.updateBody = new DevBoxDefinitionUpdate(); + return this; + } + + public DevBoxDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDevBoxDefinitions() + .update(resourceGroupName, devCenterName, devBoxDefinitionName, updateBody, Context.NONE); + return this; + } + + public DevBoxDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevBoxDefinitions() + .update(resourceGroupName, devCenterName, devBoxDefinitionName, updateBody, context); + return this; + } + + DevBoxDefinitionImpl( + DevBoxDefinitionInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.devCenterName = Utils.getValueFromIdByName(innerObject.id(), "devcenters"); + this.devBoxDefinitionName = Utils.getValueFromIdByName(innerObject.id(), "devboxdefinitions"); + } + + public DevBoxDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDevBoxDefinitions() + .getWithResponse(resourceGroupName, devCenterName, devBoxDefinitionName, Context.NONE) + .getValue(); + return this; + } + + public DevBoxDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevBoxDefinitions() + .getWithResponse(resourceGroupName, devCenterName, devBoxDefinitionName, context) + .getValue(); + return this; + } + + public DevBoxDefinitionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DevBoxDefinitionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DevBoxDefinitionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DevBoxDefinitionImpl withImageReference(ImageReference imageReference) { + if (isInCreateMode()) { + this.innerModel().withImageReference(imageReference); + return this; + } else { + this.updateBody.withImageReference(imageReference); + return this; + } + } + + public DevBoxDefinitionImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateBody.withSku(sku); + return this; + } + } + + public DevBoxDefinitionImpl withOsStorageType(String osStorageType) { + if (isInCreateMode()) { + this.innerModel().withOsStorageType(osStorageType); + return this; + } else { + this.updateBody.withOsStorageType(osStorageType); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionsClientImpl.java new file mode 100644 index 000000000000..843b7f0a9efe --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionsClientImpl.java @@ -0,0 +1,1962 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.DevBoxDefinitionsClient; +import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionInner; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinitionListResult; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinitionUpdate; +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 DevBoxDefinitionsClient. */ +public final class DevBoxDefinitionsClientImpl implements DevBoxDefinitionsClient { + /** The proxy service used to perform REST calls. */ + private final DevBoxDefinitionsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of DevBoxDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevBoxDefinitionsClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(DevBoxDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientDevBoxDefinitions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientDevBo") + private interface DevBoxDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/devboxdefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("devBoxDefinitionName") String devBoxDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("devBoxDefinitionName") String devBoxDefinitionName, + @BodyParam("application/json") DevBoxDefinitionInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("devBoxDefinitionName") String devBoxDefinitionName, + @BodyParam("application/json") DevBoxDefinitionUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("devBoxDefinitionName") String devBoxDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/devboxdefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/devboxdefinitions/{devBoxDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByProject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("devBoxDefinitionName") String devBoxDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenterNext( + @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> listByProjectNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + 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())); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top, context), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top)); + } + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top, context)); + } + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + accept, + context); + } + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + return getWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevBoxDefinitionInner get(String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + return getAsync(resourceGroupName, devCenterName, devBoxDefinitionName).block(); + } + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context) { + return getWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName, context).block(); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + body, + accept, + context); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link PollerFlux} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevBoxDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DevBoxDefinitionInner.class, + DevBoxDefinitionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link PollerFlux} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevBoxDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DevBoxDefinitionInner.class, DevBoxDefinitionInner.class, context); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevBoxDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body).getSyncPoller(); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevBoxDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context) + .getSyncPoller(); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevBoxDefinitionInner createOrUpdate( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionInner body) { + return createOrUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body).block(); + } + + /** + * Creates or updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevBoxDefinitionInner createOrUpdate( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionInner body, + Context context) { + return createOrUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context).block(); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + body, + accept, + context); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link PollerFlux} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevBoxDefinitionInner> beginUpdateAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DevBoxDefinitionInner.class, + DevBoxDefinitionInner.class, + this.client.getContext()); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link PollerFlux} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevBoxDefinitionInner> beginUpdateAsync( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DevBoxDefinitionInner.class, DevBoxDefinitionInner.class, context); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevBoxDefinitionInner> beginUpdate( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body) { + return beginUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body).getSyncPoller(); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 {@link SyncPoller} for polling of represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevBoxDefinitionInner> beginUpdate( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + Context context) { + return beginUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context).getSyncPoller(); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body) { + return beginUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + Context context) { + return beginUpdateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevBoxDefinitionInner update( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, DevBoxDefinitionUpdate body) { + return updateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body).block(); + } + + /** + * Partially updates a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box definition. + * @param body Represents a Dev Box 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 represents a definition for a Developer Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevBoxDefinitionInner update( + String resourceGroupName, + String devCenterName, + String devBoxDefinitionName, + DevBoxDefinitionUpdate body, + Context context) { + return updateAsync(resourceGroupName, devCenterName, devBoxDefinitionName, body, context).block(); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + devBoxDefinitionName, + accept, + context); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, devCenterName, devBoxDefinitionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + return beginDeleteAsync(resourceGroupName, devCenterName, devBoxDefinitionName).getSyncPoller(); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, devBoxDefinitionName, context).getSyncPoller(); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + return beginDeleteAsync(resourceGroupName, devCenterName, devBoxDefinitionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, devBoxDefinitionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 devCenterName, String devBoxDefinitionName) { + deleteAsync(resourceGroupName, devCenterName, devBoxDefinitionName).block(); + } + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 devCenterName, String devBoxDefinitionName, Context context) { + deleteAsync(resourceGroupName, devCenterName, devBoxDefinitionName, context).block(); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectSinglePageAsync( + String resourceGroupName, String projectName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + 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())); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectSinglePageAsync( + String resourceGroupName, String projectName, Integer top, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync( + String resourceGroupName, String projectName, Integer top) { + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listByProjectNextSinglePageAsync(nextLink)); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listByProjectNextSinglePageAsync(nextLink)); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top, context), + nextLink -> listByProjectNextSinglePageAsync(nextLink, context)); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProject(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedIterable<>(listByProjectAsync(resourceGroupName, projectName, top)); + } + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedIterable<>(listByProjectAsync(resourceGroupName, projectName, top, context)); + } + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByProjectWithResponseAsync( + String resourceGroupName, String projectName, String devBoxDefinitionName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + devBoxDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByProjectWithResponseAsync( + String resourceGroupName, String projectName, String devBoxDefinitionName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (devBoxDefinitionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter devBoxDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + devBoxDefinitionName, + accept, + context); + } + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByProjectAsync( + String resourceGroupName, String projectName, String devBoxDefinitionName) { + return getByProjectWithResponseAsync(resourceGroupName, projectName, devBoxDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevBoxDefinitionInner getByProject( + String resourceGroupName, String projectName, String devBoxDefinitionName) { + return getByProjectAsync(resourceGroupName, projectName, devBoxDefinitionName).block(); + } + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByProjectWithResponse( + String resourceGroupName, String projectName, String devBoxDefinitionName, Context context) { + return getByProjectWithResponseAsync(resourceGroupName, projectName, devBoxDefinitionName, 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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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.listByDevCenterNext(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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync( + 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 + .listByDevCenterNext(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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectNextSinglePageAsync(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.listByProjectNext(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 results of the Dev Box definition list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectNextSinglePageAsync( + 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 + .listByProjectNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionsImpl.java new file mode 100644 index 000000000000..0df3b54e67a8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevBoxDefinitionsImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.DevBoxDefinitionsClient; +import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionInner; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinition; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinitions; + +public final class DevBoxDefinitionsImpl implements DevBoxDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(DevBoxDefinitionsImpl.class); + + private final DevBoxDefinitionsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public DevBoxDefinitionsImpl( + DevBoxDefinitionsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName); + return Utils.mapPage(inner, inner1 -> new DevBoxDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context); + return Utils.mapPage(inner, inner1 -> new DevBoxDefinitionImpl(inner1, this.manager())); + } + + public DevBoxDefinition get(String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + DevBoxDefinitionInner inner = this.serviceClient().get(resourceGroupName, devCenterName, devBoxDefinitionName); + if (inner != null) { + return new DevBoxDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, devCenterName, devBoxDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DevBoxDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String devCenterName, String devBoxDefinitionName) { + this.serviceClient().delete(resourceGroupName, devCenterName, devBoxDefinitionName); + } + + public void delete(String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context) { + this.serviceClient().delete(resourceGroupName, devCenterName, devBoxDefinitionName, context); + } + + public PagedIterable listByProject(String resourceGroupName, String projectName) { + PagedIterable inner = this.serviceClient().listByProject(resourceGroupName, projectName); + return Utils.mapPage(inner, inner1 -> new DevBoxDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByProject(resourceGroupName, projectName, top, context); + return Utils.mapPage(inner, inner1 -> new DevBoxDefinitionImpl(inner1, this.manager())); + } + + public DevBoxDefinition getByProject(String resourceGroupName, String projectName, String devBoxDefinitionName) { + DevBoxDefinitionInner inner = + this.serviceClient().getByProject(resourceGroupName, projectName, devBoxDefinitionName); + if (inner != null) { + return new DevBoxDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByProjectWithResponse( + String resourceGroupName, String projectName, String devBoxDefinitionName, Context context) { + Response inner = + this + .serviceClient() + .getByProjectWithResponse(resourceGroupName, projectName, devBoxDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DevBoxDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DevBoxDefinition 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String devBoxDefinitionName = Utils.getValueFromIdByName(id, "devboxdefinitions"); + if (devBoxDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devboxdefinitions'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, devBoxDefinitionName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String devBoxDefinitionName = Utils.getValueFromIdByName(id, "devboxdefinitions"); + if (devBoxDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devboxdefinitions'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, devBoxDefinitionName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String devBoxDefinitionName = Utils.getValueFromIdByName(id, "devboxdefinitions"); + if (devBoxDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devboxdefinitions'.", id))); + } + this.delete(resourceGroupName, devCenterName, devBoxDefinitionName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String devBoxDefinitionName = Utils.getValueFromIdByName(id, "devboxdefinitions"); + if (devBoxDefinitionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devboxdefinitions'.", id))); + } + this.delete(resourceGroupName, devCenterName, devBoxDefinitionName, context); + } + + private DevBoxDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public DevBoxDefinitionImpl define(String name) { + return new DevBoxDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterClientBuilder.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterClientBuilder.java new file mode 100644 index 000000000000..9af0d072a609 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.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 DevCenterClientImpl type. */ +@ServiceClientBuilder(serviceClients = {DevCenterClientImpl.class}) +public final class DevCenterClientBuilder { + /* + * Unique identifier of the Azure subscription. This is a GUID-formatted + * string (e.g. 00000000-0000-0000-0000-000000000000). + */ + private String subscriptionId; + + /** + * Sets Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the DevCenterClientBuilder. + */ + public DevCenterClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the DevCenterClientBuilder. + */ + public DevCenterClientBuilder 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 DevCenterClientBuilder. + */ + public DevCenterClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 DevCenterClientBuilder. + */ + public DevCenterClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 DevCenterClientBuilder. + */ + public DevCenterClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 DevCenterClientBuilder. + */ + public DevCenterClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DevCenterClientImpl with the provided parameters. + * + * @return an instance of DevCenterClientImpl. + */ + public DevCenterClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + DevCenterClientImpl client = + new DevCenterClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterClientImpl.java new file mode 100644 index 000000000000..12e011e59524 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterClientImpl.java @@ -0,0 +1,519 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.CoreUtils; +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.devcenter.fluent.AttachedNetworksClient; +import com.azure.resourcemanager.devcenter.fluent.CatalogsClient; +import com.azure.resourcemanager.devcenter.fluent.DevBoxDefinitionsClient; +import com.azure.resourcemanager.devcenter.fluent.DevCenterClient; +import com.azure.resourcemanager.devcenter.fluent.DevCentersClient; +import com.azure.resourcemanager.devcenter.fluent.EnvironmentTypesClient; +import com.azure.resourcemanager.devcenter.fluent.GalleriesClient; +import com.azure.resourcemanager.devcenter.fluent.ImageVersionsClient; +import com.azure.resourcemanager.devcenter.fluent.ImagesClient; +import com.azure.resourcemanager.devcenter.fluent.NetworkConnectionsClient; +import com.azure.resourcemanager.devcenter.fluent.OperationStatusesClient; +import com.azure.resourcemanager.devcenter.fluent.OperationsClient; +import com.azure.resourcemanager.devcenter.fluent.PoolsClient; +import com.azure.resourcemanager.devcenter.fluent.ProjectEnvironmentTypesClient; +import com.azure.resourcemanager.devcenter.fluent.ProjectsClient; +import com.azure.resourcemanager.devcenter.fluent.SchedulesClient; +import com.azure.resourcemanager.devcenter.fluent.SkusClient; +import com.azure.resourcemanager.devcenter.fluent.UsagesClient; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the DevCenterClientImpl type. */ +@ServiceClient(builder = DevCenterClientBuilder.class) +public final class DevCenterClientImpl implements DevCenterClient { + /** + * Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + */ + private final String subscriptionId; + + /** + * Gets Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @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 DevCentersClient object to access its operations. */ + private final DevCentersClient devCenters; + + /** + * Gets the DevCentersClient object to access its operations. + * + * @return the DevCentersClient object. + */ + public DevCentersClient getDevCenters() { + return this.devCenters; + } + + /** The ProjectsClient object to access its operations. */ + private final ProjectsClient projects; + + /** + * Gets the ProjectsClient object to access its operations. + * + * @return the ProjectsClient object. + */ + public ProjectsClient getProjects() { + return this.projects; + } + + /** The AttachedNetworksClient object to access its operations. */ + private final AttachedNetworksClient attachedNetworks; + + /** + * Gets the AttachedNetworksClient object to access its operations. + * + * @return the AttachedNetworksClient object. + */ + public AttachedNetworksClient getAttachedNetworks() { + return this.attachedNetworks; + } + + /** The GalleriesClient object to access its operations. */ + private final GalleriesClient galleries; + + /** + * Gets the GalleriesClient object to access its operations. + * + * @return the GalleriesClient object. + */ + public GalleriesClient getGalleries() { + return this.galleries; + } + + /** The ImagesClient object to access its operations. */ + private final ImagesClient images; + + /** + * Gets the ImagesClient object to access its operations. + * + * @return the ImagesClient object. + */ + public ImagesClient getImages() { + return this.images; + } + + /** The ImageVersionsClient object to access its operations. */ + private final ImageVersionsClient imageVersions; + + /** + * Gets the ImageVersionsClient object to access its operations. + * + * @return the ImageVersionsClient object. + */ + public ImageVersionsClient getImageVersions() { + return this.imageVersions; + } + + /** The CatalogsClient object to access its operations. */ + private final CatalogsClient catalogs; + + /** + * Gets the CatalogsClient object to access its operations. + * + * @return the CatalogsClient object. + */ + public CatalogsClient getCatalogs() { + return this.catalogs; + } + + /** The EnvironmentTypesClient object to access its operations. */ + private final EnvironmentTypesClient environmentTypes; + + /** + * Gets the EnvironmentTypesClient object to access its operations. + * + * @return the EnvironmentTypesClient object. + */ + public EnvironmentTypesClient getEnvironmentTypes() { + return this.environmentTypes; + } + + /** The ProjectEnvironmentTypesClient object to access its operations. */ + private final ProjectEnvironmentTypesClient projectEnvironmentTypes; + + /** + * Gets the ProjectEnvironmentTypesClient object to access its operations. + * + * @return the ProjectEnvironmentTypesClient object. + */ + public ProjectEnvironmentTypesClient getProjectEnvironmentTypes() { + return this.projectEnvironmentTypes; + } + + /** The DevBoxDefinitionsClient object to access its operations. */ + private final DevBoxDefinitionsClient devBoxDefinitions; + + /** + * Gets the DevBoxDefinitionsClient object to access its operations. + * + * @return the DevBoxDefinitionsClient object. + */ + public DevBoxDefinitionsClient getDevBoxDefinitions() { + return this.devBoxDefinitions; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The OperationStatusesClient object to access its operations. */ + private final OperationStatusesClient operationStatuses; + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + public OperationStatusesClient getOperationStatuses() { + return this.operationStatuses; + } + + /** The UsagesClient object to access its operations. */ + private final UsagesClient usages; + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + public UsagesClient getUsages() { + return this.usages; + } + + /** The SkusClient object to access its operations. */ + private final SkusClient skus; + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + public SkusClient getSkus() { + return this.skus; + } + + /** The PoolsClient object to access its operations. */ + private final PoolsClient pools; + + /** + * Gets the PoolsClient object to access its operations. + * + * @return the PoolsClient object. + */ + public PoolsClient getPools() { + return this.pools; + } + + /** The SchedulesClient object to access its operations. */ + private final SchedulesClient schedules; + + /** + * Gets the SchedulesClient object to access its operations. + * + * @return the SchedulesClient object. + */ + public SchedulesClient getSchedules() { + return this.schedules; + } + + /** The NetworkConnectionsClient object to access its operations. */ + private final NetworkConnectionsClient networkConnections; + + /** + * Gets the NetworkConnectionsClient object to access its operations. + * + * @return the NetworkConnectionsClient object. + */ + public NetworkConnectionsClient getNetworkConnections() { + return this.networkConnections; + } + + /** + * Initializes an instance of DevCenterClient 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 Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + DevCenterClientImpl( + 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 = "2022-08-01-preview"; + this.devCenters = new DevCentersClientImpl(this); + this.projects = new ProjectsClientImpl(this); + this.attachedNetworks = new AttachedNetworksClientImpl(this); + this.galleries = new GalleriesClientImpl(this); + this.images = new ImagesClientImpl(this); + this.imageVersions = new ImageVersionsClientImpl(this); + this.catalogs = new CatalogsClientImpl(this); + this.environmentTypes = new EnvironmentTypesClientImpl(this); + this.projectEnvironmentTypes = new ProjectEnvironmentTypesClientImpl(this); + this.devBoxDefinitions = new DevBoxDefinitionsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.skus = new SkusClientImpl(this); + this.pools = new PoolsClientImpl(this); + this.schedules = new SchedulesClientImpl(this); + this.networkConnections = new NetworkConnectionsClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DevCenterClientImpl.class); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterImpl.java new file mode 100644 index 000000000000..f6080b1e235c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterInner; +import com.azure.resourcemanager.devcenter.models.DevCenter; +import com.azure.resourcemanager.devcenter.models.DevCenterUpdate; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class DevCenterImpl implements DevCenter, DevCenter.Definition, DevCenter.Update { + private DevCenterInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DevCenterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String devCenterName; + + private DevCenterUpdate updateBody; + + public DevCenterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DevCenter create() { + this.innerObject = + serviceManager + .serviceClient() + .getDevCenters() + .createOrUpdate(resourceGroupName, devCenterName, this.innerModel(), Context.NONE); + return this; + } + + public DevCenter create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevCenters() + .createOrUpdate(resourceGroupName, devCenterName, this.innerModel(), context); + return this; + } + + DevCenterImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new DevCenterInner(); + this.serviceManager = serviceManager; + this.devCenterName = name; + } + + public DevCenterImpl update() { + this.updateBody = new DevCenterUpdate(); + return this; + } + + public DevCenter apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDevCenters() + .update(resourceGroupName, devCenterName, updateBody, Context.NONE); + return this; + } + + public DevCenter apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevCenters() + .update(resourceGroupName, devCenterName, updateBody, context); + return this; + } + + DevCenterImpl(DevCenterInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.devCenterName = Utils.getValueFromIdByName(innerObject.id(), "devcenters"); + } + + public DevCenter refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDevCenters() + .getByResourceGroupWithResponse(resourceGroupName, devCenterName, Context.NONE) + .getValue(); + return this; + } + + public DevCenter refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevCenters() + .getByResourceGroupWithResponse(resourceGroupName, devCenterName, context) + .getValue(); + return this; + } + + public DevCenterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DevCenterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DevCenterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DevCenterImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateBody.withIdentity(identity); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterSkuImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterSkuImpl.java new file mode 100644 index 000000000000..a492c16a67c1 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCenterSkuImpl.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.devcenter.implementation; + +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner; +import com.azure.resourcemanager.devcenter.models.Capability; +import com.azure.resourcemanager.devcenter.models.DevCenterSku; +import com.azure.resourcemanager.devcenter.models.SkuTier; +import java.util.Collections; +import java.util.List; + +public final class DevCenterSkuImpl implements DevCenterSku { + private DevCenterSkuInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + DevCenterSkuImpl( + DevCenterSkuInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public SkuTier tier() { + return this.innerModel().tier(); + } + + public String size() { + return this.innerModel().size(); + } + + public String family() { + return this.innerModel().family(); + } + + public Integer capacity() { + return this.innerModel().capacity(); + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List capabilities() { + List inner = this.innerModel().capabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DevCenterSkuInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCentersClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCentersClientImpl.java new file mode 100644 index 000000000000..08dc7dd4dd03 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCentersClientImpl.java @@ -0,0 +1,1585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.DevCentersClient; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterInner; +import com.azure.resourcemanager.devcenter.models.DevCenterListResult; +import com.azure.resourcemanager.devcenter.models.DevCenterUpdate; +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 DevCentersClient. */ +public final class DevCentersClientImpl implements DevCentersClient { + /** The proxy service used to perform REST calls. */ + private final DevCentersService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of DevCentersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevCentersClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(DevCentersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientDevCenters to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientDevCe") + private interface DevCentersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/devcenters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @BodyParam("application/json") DevCenterInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @BodyParam("application/json") DevCenterUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @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); + + @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); + } + + /** + * Lists all devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + 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 devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all devcenters in 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 result of the list devcenters operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all devcenters in 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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + return new PagedIterable<>(listAsync(top)); + } + + /** + * Lists all devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Context context) { + return new PagedIterable<>(listAsync(top, context)); + } + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + 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 devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the list devcenters operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top)); + } + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, context)); + } + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String devCenterName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String devCenterName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + accept, + context); + } + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String devCenterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, devCenterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevCenterInner getByResourceGroup(String resourceGroupName, String devCenterName) { + return getByResourceGroupAsync(resourceGroupName, devCenterName).block(); + } + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String devCenterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, devCenterName, context).block(); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, DevCenterInner body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, DevCenterInner body, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + body, + accept, + context); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevCenterInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, DevCenterInner body) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DevCenterInner.class, + DevCenterInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevCenterInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, DevCenterInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DevCenterInner.class, DevCenterInner.class, context); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevCenterInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, DevCenterInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, body).getSyncPoller(); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevCenterInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, DevCenterInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, body, context).getSyncPoller(); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, DevCenterInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, DevCenterInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevCenterInner createOrUpdate(String resourceGroupName, String devCenterName, DevCenterInner body) { + return createOrUpdateAsync(resourceGroupName, devCenterName, body).block(); + } + + /** + * Creates or updates a devcenter resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Represents a devcenter. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevCenterInner createOrUpdate( + String resourceGroupName, String devCenterName, DevCenterInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, devCenterName, body, context).block(); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String devCenterName, DevCenterUpdate body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String devCenterName, DevCenterUpdate body, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + body, + accept, + context); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevCenterInner> beginUpdateAsync( + String resourceGroupName, String devCenterName, DevCenterUpdate body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, devCenterName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DevCenterInner.class, + DevCenterInner.class, + this.client.getContext()); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevCenterInner> beginUpdateAsync( + String resourceGroupName, String devCenterName, DevCenterUpdate body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, devCenterName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DevCenterInner.class, DevCenterInner.class, context); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevCenterInner> beginUpdate( + String resourceGroupName, String devCenterName, DevCenterUpdate body) { + return beginUpdateAsync(resourceGroupName, devCenterName, body).getSyncPoller(); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevCenterInner> beginUpdate( + String resourceGroupName, String devCenterName, DevCenterUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, devCenterName, body, context).getSyncPoller(); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String devCenterName, DevCenterUpdate body) { + return beginUpdateAsync(resourceGroupName, devCenterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String devCenterName, DevCenterUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, devCenterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevCenterInner update(String resourceGroupName, String devCenterName, DevCenterUpdate body) { + return updateAsync(resourceGroupName, devCenterName, body).block(); + } + + /** + * Partially updates a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param body Updatable devcenter properties. + * @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 represents a devcenter resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevCenterInner update( + String resourceGroupName, String devCenterName, DevCenterUpdate body, Context context) { + return updateAsync(resourceGroupName, devCenterName, body, context).block(); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String devCenterName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + accept, + context); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String devCenterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, devCenterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, devCenterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String devCenterName) { + return beginDeleteAsync(resourceGroupName, devCenterName).getSyncPoller(); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, context).getSyncPoller(); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String devCenterName) { + return beginDeleteAsync(resourceGroupName, devCenterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String devCenterName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devCenterName) { + deleteAsync(resourceGroupName, devCenterName).block(); + } + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devCenterName, Context context) { + deleteAsync(resourceGroupName, devCenterName, 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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)); + } + + /** + * 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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 result of the list devcenters operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCentersImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCentersImpl.java new file mode 100644 index 000000000000..f5b55642c6f5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/DevCentersImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.DevCentersClient; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterInner; +import com.azure.resourcemanager.devcenter.models.DevCenter; +import com.azure.resourcemanager.devcenter.models.DevCenters; + +public final class DevCentersImpl implements DevCenters { + private static final ClientLogger LOGGER = new ClientLogger(DevCentersImpl.class); + + private final DevCentersClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public DevCentersImpl( + DevCentersClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DevCenterImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(top, context); + return Utils.mapPage(inner, inner1 -> new DevCenterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DevCenterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, top, context); + return Utils.mapPage(inner, inner1 -> new DevCenterImpl(inner1, this.manager())); + } + + public DevCenter getByResourceGroup(String resourceGroupName, String devCenterName) { + DevCenterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, devCenterName); + if (inner != null) { + return new DevCenterImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String devCenterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, devCenterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DevCenterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String devCenterName) { + this.serviceClient().delete(resourceGroupName, devCenterName); + } + + public void delete(String resourceGroupName, String devCenterName, Context context) { + this.serviceClient().delete(resourceGroupName, devCenterName, context); + } + + public DevCenter 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, devCenterName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, devCenterName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + this.delete(resourceGroupName, devCenterName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + this.delete(resourceGroupName, devCenterName, context); + } + + private DevCentersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public DevCenterImpl define(String name) { + return new DevCenterImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypeImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypeImpl.java new file mode 100644 index 000000000000..04a69b2daef6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypeImpl.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.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.EnvironmentType; +import com.azure.resourcemanager.devcenter.models.EnvironmentTypeUpdate; +import java.util.Collections; +import java.util.Map; + +public final class EnvironmentTypeImpl implements EnvironmentType, EnvironmentType.Definition, EnvironmentType.Update { + private EnvironmentTypeInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + 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 provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EnvironmentTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String devCenterName; + + private String environmentTypeName; + + private EnvironmentTypeUpdate updateBody; + + public EnvironmentTypeImpl withExistingDevcenter(String resourceGroupName, String devCenterName) { + this.resourceGroupName = resourceGroupName; + this.devCenterName = devCenterName; + return this; + } + + public EnvironmentType create() { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironmentTypes() + .createOrUpdateWithResponse( + resourceGroupName, devCenterName, environmentTypeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public EnvironmentType create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironmentTypes() + .createOrUpdateWithResponse( + resourceGroupName, devCenterName, environmentTypeName, this.innerModel(), context) + .getValue(); + return this; + } + + EnvironmentTypeImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new EnvironmentTypeInner(); + this.serviceManager = serviceManager; + this.environmentTypeName = name; + } + + public EnvironmentTypeImpl update() { + this.updateBody = new EnvironmentTypeUpdate(); + return this; + } + + public EnvironmentType apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironmentTypes() + .updateWithResponse(resourceGroupName, devCenterName, environmentTypeName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public EnvironmentType apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironmentTypes() + .updateWithResponse(resourceGroupName, devCenterName, environmentTypeName, updateBody, context) + .getValue(); + return this; + } + + EnvironmentTypeImpl( + EnvironmentTypeInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.devCenterName = Utils.getValueFromIdByName(innerObject.id(), "devcenters"); + this.environmentTypeName = Utils.getValueFromIdByName(innerObject.id(), "environmentTypes"); + } + + public EnvironmentType refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironmentTypes() + .getWithResponse(resourceGroupName, devCenterName, environmentTypeName, Context.NONE) + .getValue(); + return this; + } + + public EnvironmentType refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironmentTypes() + .getWithResponse(resourceGroupName, devCenterName, environmentTypeName, context) + .getValue(); + return this; + } + + public EnvironmentTypeImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypesClientImpl.java new file mode 100644 index 000000000000..43e69f711fe9 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypesClientImpl.java @@ -0,0 +1,1122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.devcenter.fluent.EnvironmentTypesClient; +import com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.EnvironmentTypeListResult; +import com.azure.resourcemanager.devcenter.models.EnvironmentTypeUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EnvironmentTypesClient. */ +public final class EnvironmentTypesClientImpl implements EnvironmentTypesClient { + /** The proxy service used to perform REST calls. */ + private final EnvironmentTypesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of EnvironmentTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnvironmentTypesClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(EnvironmentTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientEnvironmentTypes to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientEnvir") + private interface EnvironmentTypesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/environmentTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("environmentTypeName") String environmentTypeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("environmentTypeName") String environmentTypeName, + @BodyParam("application/json") EnvironmentTypeInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("environmentTypeName") String environmentTypeName, + @BodyParam("application/json") EnvironmentTypeUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("environmentTypeName") String environmentTypeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + 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 environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 result of the environment type list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top, context), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 result of the environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top)); + } + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top, context)); + } + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String environmentTypeName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String environmentTypeName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + accept, + context); + } + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String devCenterName, String environmentTypeName) { + return getWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentTypeInner get(String resourceGroupName, String devCenterName, String environmentTypeName) { + return getAsync(resourceGroupName, devCenterName, environmentTypeName).block(); + } + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context) { + return getWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName, context).block(); + } + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeInner body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String devCenterName, + String environmentTypeName, + EnvironmentTypeInner body, + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + body, + accept, + context); + } + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentTypeInner createOrUpdate( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeInner body) { + return createOrUpdateAsync(resourceGroupName, devCenterName, environmentTypeName, body).block(); + } + + /** + * Creates or updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Represents an Environment Type. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String devCenterName, + String environmentTypeName, + EnvironmentTypeInner body, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName, body, context) + .block(); + } + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeUpdate body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String devCenterName, + String environmentTypeName, + EnvironmentTypeUpdate body, + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + body, + accept, + context); + } + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeUpdate body) { + return updateWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentTypeInner update( + String resourceGroupName, String devCenterName, String environmentTypeName, EnvironmentTypeUpdate body) { + return updateAsync(resourceGroupName, devCenterName, environmentTypeName, body).block(); + } + + /** + * Partially updates an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param body Updatable environment type properties. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String devCenterName, + String environmentTypeName, + EnvironmentTypeUpdate body, + Context context) { + return updateWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName, body, context).block(); + } + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String environmentTypeName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String environmentTypeName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + environmentTypeName, + accept, + context); + } + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String devCenterName, String environmentTypeName) { + return deleteWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 devCenterName, String environmentTypeName) { + deleteAsync(resourceGroupName, devCenterName, environmentTypeName).block(); + } + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context) { + return deleteWithResponseAsync(resourceGroupName, devCenterName, environmentTypeName, 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 result of the environment type list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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.listByDevCenterNext(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 result of the environment type list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync( + 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 + .listByDevCenterNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypesImpl.java new file mode 100644 index 000000000000..cdf799a84439 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/EnvironmentTypesImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.EnvironmentTypesClient; +import com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.EnvironmentType; +import com.azure.resourcemanager.devcenter.models.EnvironmentTypes; + +public final class EnvironmentTypesImpl implements EnvironmentTypes { + private static final ClientLogger LOGGER = new ClientLogger(EnvironmentTypesImpl.class); + + private final EnvironmentTypesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public EnvironmentTypesImpl( + EnvironmentTypesClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName); + return Utils.mapPage(inner, inner1 -> new EnvironmentTypeImpl(inner1, this.manager())); + } + + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context); + return Utils.mapPage(inner, inner1 -> new EnvironmentTypeImpl(inner1, this.manager())); + } + + public EnvironmentType get(String resourceGroupName, String devCenterName, String environmentTypeName) { + EnvironmentTypeInner inner = this.serviceClient().get(resourceGroupName, devCenterName, environmentTypeName); + if (inner != null) { + return new EnvironmentTypeImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, devCenterName, environmentTypeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EnvironmentTypeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String devCenterName, String environmentTypeName) { + this.serviceClient().delete(resourceGroupName, devCenterName, environmentTypeName); + } + + public Response deleteWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, devCenterName, environmentTypeName, context); + } + + public EnvironmentType 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, environmentTypeName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, environmentTypeName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + this.deleteWithResponse(resourceGroupName, devCenterName, environmentTypeName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + return this.deleteWithResponse(resourceGroupName, devCenterName, environmentTypeName, context); + } + + private EnvironmentTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public EnvironmentTypeImpl define(String name) { + return new EnvironmentTypeImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleriesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleriesClientImpl.java new file mode 100644 index 000000000000..007a97580a1f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleriesClientImpl.java @@ -0,0 +1,1111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.GalleriesClient; +import com.azure.resourcemanager.devcenter.fluent.models.GalleryInner; +import com.azure.resourcemanager.devcenter.models.GalleryListResult; +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 GalleriesClient. */ +public final class GalleriesClientImpl implements GalleriesClient { + /** The proxy service used to perform REST calls. */ + private final GalleriesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of GalleriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleriesClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(GalleriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientGalleries to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientGalle") + private interface GalleriesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @BodyParam("application/json") GalleryInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + 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 galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName, Integer top) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the gallery list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top, context), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the gallery list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top)); + } + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top, context)); + } + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + accept, + context); + } + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String devCenterName, String galleryName) { + return getWithResponseAsync(resourceGroupName, devCenterName, galleryName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner get(String resourceGroupName, String devCenterName, String galleryName) { + return getAsync(resourceGroupName, devCenterName, galleryName).block(); + } + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, Context context) { + return getWithResponseAsync(resourceGroupName, devCenterName, galleryName, context).block(); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + body, + accept, + context); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a gallery. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, galleryName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryInner.class, GalleryInner.class, this.client.getContext()); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a gallery. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryInner> beginCreateOrUpdateAsync( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, devCenterName, galleryName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryInner.class, GalleryInner.class, context); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a gallery. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, galleryName, body).getSyncPoller(); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a gallery. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, galleryName, body, context).getSyncPoller(); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, galleryName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, devCenterName, galleryName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner createOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body) { + return createOrUpdateAsync(resourceGroupName, devCenterName, galleryName, body).block(); + } + + /** + * Creates or updates a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param body Represents a gallery. + * @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 represents a gallery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner createOrUpdate( + String resourceGroupName, String devCenterName, String galleryName, GalleryInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, devCenterName, galleryName, body, context).block(); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + accept, + context); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String galleryName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, devCenterName, galleryName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String devCenterName, String galleryName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, devCenterName, galleryName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String galleryName) { + return beginDeleteAsync(resourceGroupName, devCenterName, galleryName).getSyncPoller(); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String devCenterName, String galleryName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, galleryName, context).getSyncPoller(); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String devCenterName, String galleryName) { + return beginDeleteAsync(resourceGroupName, devCenterName, galleryName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String devCenterName, String galleryName, Context context) { + return beginDeleteAsync(resourceGroupName, devCenterName, galleryName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 devCenterName, String galleryName) { + deleteAsync(resourceGroupName, devCenterName, galleryName).block(); + } + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 devCenterName, String galleryName, Context context) { + deleteAsync(resourceGroupName, devCenterName, galleryName, 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 results of the gallery list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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.listByDevCenterNext(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 results of the gallery list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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 + .listByDevCenterNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleriesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleriesImpl.java new file mode 100644 index 000000000000..933abdd534f8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleriesImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.GalleriesClient; +import com.azure.resourcemanager.devcenter.fluent.models.GalleryInner; +import com.azure.resourcemanager.devcenter.models.Galleries; +import com.azure.resourcemanager.devcenter.models.Gallery; + +public final class GalleriesImpl implements Galleries { + private static final ClientLogger LOGGER = new ClientLogger(GalleriesImpl.class); + + private final GalleriesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public GalleriesImpl( + GalleriesClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + PagedIterable inner = this.serviceClient().listByDevCenter(resourceGroupName, devCenterName); + return Utils.mapPage(inner, inner1 -> new GalleryImpl(inner1, this.manager())); + } + + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context); + return Utils.mapPage(inner, inner1 -> new GalleryImpl(inner1, this.manager())); + } + + public Gallery get(String resourceGroupName, String devCenterName, String galleryName) { + GalleryInner inner = this.serviceClient().get(resourceGroupName, devCenterName, galleryName); + if (inner != null) { + return new GalleryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, devCenterName, galleryName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GalleryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String devCenterName, String galleryName) { + this.serviceClient().delete(resourceGroupName, devCenterName, galleryName); + } + + public void delete(String resourceGroupName, String devCenterName, String galleryName, Context context) { + this.serviceClient().delete(resourceGroupName, devCenterName, galleryName, context); + } + + public Gallery 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, galleryName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + return this.getWithResponse(resourceGroupName, devCenterName, galleryName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + this.delete(resourceGroupName, devCenterName, galleryName, 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 devCenterName = Utils.getValueFromIdByName(id, "devcenters"); + if (devCenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devcenters'.", id))); + } + String galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + this.delete(resourceGroupName, devCenterName, galleryName, context); + } + + private GalleriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public GalleryImpl define(String name) { + return new GalleryImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleryImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleryImpl.java new file mode 100644 index 000000000000..8e0937e0726f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/GalleryImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.GalleryInner; +import com.azure.resourcemanager.devcenter.models.Gallery; + +public final class GalleryImpl implements Gallery, Gallery.Definition, Gallery.Update { + private GalleryInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String galleryResourceId() { + return this.innerModel().galleryResourceId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public GalleryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String devCenterName; + + private String galleryName; + + public GalleryImpl withExistingDevcenter(String resourceGroupName, String devCenterName) { + this.resourceGroupName = resourceGroupName; + this.devCenterName = devCenterName; + return this; + } + + public Gallery create() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .createOrUpdate(resourceGroupName, devCenterName, galleryName, this.innerModel(), Context.NONE); + return this; + } + + public Gallery create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .createOrUpdate(resourceGroupName, devCenterName, galleryName, this.innerModel(), context); + return this; + } + + GalleryImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new GalleryInner(); + this.serviceManager = serviceManager; + this.galleryName = name; + } + + public GalleryImpl update() { + return this; + } + + public Gallery apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .createOrUpdate(resourceGroupName, devCenterName, galleryName, this.innerModel(), Context.NONE); + return this; + } + + public Gallery apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .createOrUpdate(resourceGroupName, devCenterName, galleryName, this.innerModel(), context); + return this; + } + + GalleryImpl(GalleryInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.devCenterName = Utils.getValueFromIdByName(innerObject.id(), "devcenters"); + this.galleryName = Utils.getValueFromIdByName(innerObject.id(), "galleries"); + } + + public Gallery refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .getWithResponse(resourceGroupName, devCenterName, galleryName, Context.NONE) + .getValue(); + return this; + } + + public Gallery refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .getWithResponse(resourceGroupName, devCenterName, galleryName, context) + .getValue(); + return this; + } + + public GalleryImpl withGalleryResourceId(String galleryResourceId) { + this.innerModel().withGalleryResourceId(galleryResourceId); + return this; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/HealthCheckStatusDetailsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/HealthCheckStatusDetailsImpl.java new file mode 100644 index 000000000000..a1db714f6b13 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/HealthCheckStatusDetailsImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.fluent.models.HealthCheckStatusDetailsInner; +import com.azure.resourcemanager.devcenter.models.HealthCheck; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatusDetails; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class HealthCheckStatusDetailsImpl implements HealthCheckStatusDetails { + private HealthCheckStatusDetailsInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + HealthCheckStatusDetailsImpl( + HealthCheckStatusDetailsInner innerObject, + com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public OffsetDateTime startDateTime() { + return this.innerModel().startDateTime(); + } + + public OffsetDateTime endDateTime() { + return this.innerModel().endDateTime(); + } + + public List healthChecks() { + List inner = this.innerModel().healthChecks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public HealthCheckStatusDetailsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageImpl.java new file mode 100644 index 000000000000..ca0ecc549016 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.resourcemanager.devcenter.fluent.models.ImageInner; +import com.azure.resourcemanager.devcenter.models.Image; +import com.azure.resourcemanager.devcenter.models.RecommendedMachineConfiguration; + +public final class ImageImpl implements Image { + private ImageInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + ImageImpl(ImageInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String offer() { + return this.innerModel().offer(); + } + + public String sku() { + return this.innerModel().sku(); + } + + public RecommendedMachineConfiguration recommendedMachineConfiguration() { + return this.innerModel().recommendedMachineConfiguration(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionImpl.java new file mode 100644 index 000000000000..b567ad0a249c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner; +import com.azure.resourcemanager.devcenter.models.ImageVersion; +import java.time.OffsetDateTime; + +public final class ImageVersionImpl implements ImageVersion { + private ImageVersionInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + ImageVersionImpl( + ImageVersionInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String namePropertiesName() { + return this.innerModel().namePropertiesName(); + } + + public OffsetDateTime publishedDate() { + return this.innerModel().publishedDate(); + } + + public Boolean excludeFromLatest() { + return this.innerModel().excludeFromLatest(); + } + + public Integer osDiskImageSizeInGb() { + return this.innerModel().osDiskImageSizeInGb(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ImageVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionsClientImpl.java new file mode 100644 index 000000000000..e6aac39ca180 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionsClientImpl.java @@ -0,0 +1,583 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.resourcemanager.devcenter.fluent.ImageVersionsClient; +import com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner; +import com.azure.resourcemanager.devcenter.models.ImageVersionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ImageVersionsClient. */ +public final class ImageVersionsClientImpl implements ImageVersionsClient { + /** The proxy service used to perform REST calls. */ + private final ImageVersionsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of ImageVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImageVersionsClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(ImageVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientImageVersions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientImage") + private interface ImageVersionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByImage( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @PathParam("imageName") String imageName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}/versions/{versionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @PathParam("imageName") String imageName, + @PathParam("versionName") String versionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByImageNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByImageSinglePageAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByImage( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + imageName, + 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 versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByImageSinglePageAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByImage( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + imageName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByImageAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName) { + return new PagedFlux<>( + () -> listByImageSinglePageAsync(resourceGroupName, devCenterName, galleryName, imageName), + nextLink -> listByImageNextSinglePageAsync(nextLink)); + } + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByImageAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context) { + return new PagedFlux<>( + () -> listByImageSinglePageAsync(resourceGroupName, devCenterName, galleryName, imageName, context), + nextLink -> listByImageNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName) { + return new PagedIterable<>(listByImageAsync(resourceGroupName, devCenterName, galleryName, imageName)); + } + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context) { + return new PagedIterable<>(listByImageAsync(resourceGroupName, devCenterName, galleryName, imageName, context)); + } + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName, String versionName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + imageName, + versionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String devCenterName, + String galleryName, + String imageName, + String versionName, + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + imageName, + versionName, + accept, + context); + } + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName, String versionName) { + return getWithResponseAsync(resourceGroupName, devCenterName, galleryName, imageName, versionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageVersionInner get( + String resourceGroupName, String devCenterName, String galleryName, String imageName, String versionName) { + return getAsync(resourceGroupName, devCenterName, galleryName, imageName, versionName).block(); + } + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String devCenterName, + String galleryName, + String imageName, + String versionName, + Context context) { + return getWithResponseAsync(resourceGroupName, devCenterName, galleryName, imageName, versionName, 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 results of the image version list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByImageNextSinglePageAsync(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.listByImageNext(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 results of the image version list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByImageNextSinglePageAsync(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 + .listByImageNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionsImpl.java new file mode 100644 index 000000000000..8449a57cd1e8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImageVersionsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.ImageVersionsClient; +import com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner; +import com.azure.resourcemanager.devcenter.models.ImageVersion; +import com.azure.resourcemanager.devcenter.models.ImageVersions; + +public final class ImageVersionsImpl implements ImageVersions { + private static final ClientLogger LOGGER = new ClientLogger(ImageVersionsImpl.class); + + private final ImageVersionsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public ImageVersionsImpl( + ImageVersionsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName) { + PagedIterable inner = + this.serviceClient().listByImage(resourceGroupName, devCenterName, galleryName, imageName); + return Utils.mapPage(inner, inner1 -> new ImageVersionImpl(inner1, this.manager())); + } + + public PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context) { + PagedIterable inner = + this.serviceClient().listByImage(resourceGroupName, devCenterName, galleryName, imageName, context); + return Utils.mapPage(inner, inner1 -> new ImageVersionImpl(inner1, this.manager())); + } + + public ImageVersion get( + String resourceGroupName, String devCenterName, String galleryName, String imageName, String versionName) { + ImageVersionInner inner = + this.serviceClient().get(resourceGroupName, devCenterName, galleryName, imageName, versionName); + if (inner != null) { + return new ImageVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String devCenterName, + String galleryName, + String imageName, + String versionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, devCenterName, galleryName, imageName, versionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ImageVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ImageVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImagesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImagesClientImpl.java new file mode 100644 index 000000000000..539814d0f1eb --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImagesClientImpl.java @@ -0,0 +1,876 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.resourcemanager.devcenter.fluent.ImagesClient; +import com.azure.resourcemanager.devcenter.fluent.models.ImageInner; +import com.azure.resourcemanager.devcenter.models.ImageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ImagesClient. */ +public final class ImagesClientImpl implements ImagesClient { + /** The proxy service used to perform REST calls. */ + private final ImagesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of ImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImagesClientImpl(DevCenterClientImpl client) { + this.service = RestProxy.create(ImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientImages to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientImage") + private interface ImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenter( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByGallery( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("devCenterName") String devCenterName, + @PathParam("galleryName") String galleryName, + @PathParam("imageName") String imageName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDevCenterNext( + @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> listByGalleryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + 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 images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterSinglePageAsync( + String resourceGroupName, String devCenterName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDevCenter( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName, Integer top) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink)); + } + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDevCenterAsync( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByDevCenterSinglePageAsync(resourceGroupName, devCenterName, top, context), + nextLink -> listByDevCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + final Integer top = null; + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top)); + } + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + return new PagedIterable<>(listByDevCenterAsync(resourceGroupName, devCenterName, top, context)); + } + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGallerySinglePageAsync( + String resourceGroupName, String devCenterName, String galleryName, Integer top) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByGallery( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + top, + 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 images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGallerySinglePageAsync( + String resourceGroupName, String devCenterName, String galleryName, Integer top, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGallery( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync( + String resourceGroupName, String devCenterName, String galleryName, Integer top) { + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, devCenterName, galleryName, top), + nextLink -> listByGalleryNextSinglePageAsync(nextLink)); + } + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 results of the image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync( + String resourceGroupName, String devCenterName, String galleryName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, devCenterName, galleryName, top), + nextLink -> listByGalleryNextSinglePageAsync(nextLink)); + } + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync( + String resourceGroupName, String devCenterName, String galleryName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, devCenterName, galleryName, top, context), + nextLink -> listByGalleryNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGallery(String resourceGroupName, String devCenterName, String galleryName) { + final Integer top = null; + return new PagedIterable<>(listByGalleryAsync(resourceGroupName, devCenterName, galleryName, top)); + } + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGallery( + String resourceGroupName, String devCenterName, String galleryName, Integer top, Context context) { + return new PagedIterable<>(listByGalleryAsync(resourceGroupName, devCenterName, galleryName, top, context)); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName) { + 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + imageName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName, 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 (devCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter devCenterName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + devCenterName, + galleryName, + imageName, + accept, + context); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String devCenterName, String galleryName, String imageName) { + return getWithResponseAsync(resourceGroupName, devCenterName, galleryName, imageName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner get(String resourceGroupName, String devCenterName, String galleryName, String imageName) { + return getAsync(resourceGroupName, devCenterName, galleryName, imageName).block(); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context) { + return getWithResponseAsync(resourceGroupName, devCenterName, galleryName, imageName, 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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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.listByDevCenterNext(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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDevCenterNextSinglePageAsync(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 + .listByDevCenterNext(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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryNextSinglePageAsync(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.listByGalleryNext(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 results of the image list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryNextSinglePageAsync(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 + .listByGalleryNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImagesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImagesImpl.java new file mode 100644 index 000000000000..6ed4eb7202c4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ImagesImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.ImagesClient; +import com.azure.resourcemanager.devcenter.fluent.models.ImageInner; +import com.azure.resourcemanager.devcenter.models.Image; +import com.azure.resourcemanager.devcenter.models.Images; + +public final class ImagesImpl implements Images { + private static final ClientLogger LOGGER = new ClientLogger(ImagesImpl.class); + + private final ImagesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public ImagesImpl(ImagesClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDevCenter(String resourceGroupName, String devCenterName) { + PagedIterable inner = this.serviceClient().listByDevCenter(resourceGroupName, devCenterName); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByDevCenter(resourceGroupName, devCenterName, top, context); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable listByGallery(String resourceGroupName, String devCenterName, String galleryName) { + PagedIterable inner = + this.serviceClient().listByGallery(resourceGroupName, devCenterName, galleryName); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable listByGallery( + String resourceGroupName, String devCenterName, String galleryName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByGallery(resourceGroupName, devCenterName, galleryName, top, context); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public Image get(String resourceGroupName, String devCenterName, String galleryName, String imageName) { + ImageInner inner = this.serviceClient().get(resourceGroupName, devCenterName, galleryName, imageName); + if (inner != null) { + return new ImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, devCenterName, galleryName, imageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionImpl.java new file mode 100644 index 000000000000..777e709ec3ca --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.NetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.DomainJoinType; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatus; +import com.azure.resourcemanager.devcenter.models.NetworkConnection; +import com.azure.resourcemanager.devcenter.models.NetworkConnectionUpdate; +import java.util.Collections; +import java.util.Map; + +public final class NetworkConnectionImpl + implements NetworkConnection, NetworkConnection.Definition, NetworkConnection.Update { + private NetworkConnectionInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager 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 provisioningState() { + return this.innerModel().provisioningState(); + } + + public HealthCheckStatus healthCheckStatus() { + return this.innerModel().healthCheckStatus(); + } + + public String networkingResourceGroupName() { + return this.innerModel().networkingResourceGroupName(); + } + + public DomainJoinType domainJoinType() { + return this.innerModel().domainJoinType(); + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public String domainName() { + return this.innerModel().domainName(); + } + + public String organizationUnit() { + return this.innerModel().organizationUnit(); + } + + public String domainUsername() { + return this.innerModel().domainUsername(); + } + + public String domainPassword() { + return this.innerModel().domainPassword(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NetworkConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String networkConnectionName; + + private NetworkConnectionUpdate updateBody; + + public NetworkConnectionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NetworkConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getNetworkConnections() + .createOrUpdate(resourceGroupName, networkConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public NetworkConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNetworkConnections() + .createOrUpdate(resourceGroupName, networkConnectionName, this.innerModel(), context); + return this; + } + + NetworkConnectionImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new NetworkConnectionInner(); + this.serviceManager = serviceManager; + this.networkConnectionName = name; + } + + public NetworkConnectionImpl update() { + this.updateBody = new NetworkConnectionUpdate(); + return this; + } + + public NetworkConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getNetworkConnections() + .update(resourceGroupName, networkConnectionName, updateBody, Context.NONE); + return this; + } + + public NetworkConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNetworkConnections() + .update(resourceGroupName, networkConnectionName, updateBody, context); + return this; + } + + NetworkConnectionImpl( + NetworkConnectionInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.networkConnectionName = Utils.getValueFromIdByName(innerObject.id(), "networkConnections"); + } + + public NetworkConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getNetworkConnections() + .getByResourceGroupWithResponse(resourceGroupName, networkConnectionName, Context.NONE) + .getValue(); + return this; + } + + public NetworkConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNetworkConnections() + .getByResourceGroupWithResponse(resourceGroupName, networkConnectionName, context) + .getValue(); + return this; + } + + public void runHealthChecks() { + serviceManager.networkConnections().runHealthChecks(resourceGroupName, networkConnectionName); + } + + public Response runHealthChecksWithResponse(Context context) { + return serviceManager + .networkConnections() + .runHealthChecksWithResponse(resourceGroupName, networkConnectionName, context); + } + + public NetworkConnectionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NetworkConnectionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NetworkConnectionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public NetworkConnectionImpl withNetworkingResourceGroupName(String networkingResourceGroupName) { + this.innerModel().withNetworkingResourceGroupName(networkingResourceGroupName); + return this; + } + + public NetworkConnectionImpl withDomainJoinType(DomainJoinType domainJoinType) { + this.innerModel().withDomainJoinType(domainJoinType); + return this; + } + + public NetworkConnectionImpl withSubnetId(String subnetId) { + if (isInCreateMode()) { + this.innerModel().withSubnetId(subnetId); + return this; + } else { + this.updateBody.withSubnetId(subnetId); + return this; + } + } + + public NetworkConnectionImpl withDomainName(String domainName) { + if (isInCreateMode()) { + this.innerModel().withDomainName(domainName); + return this; + } else { + this.updateBody.withDomainName(domainName); + return this; + } + } + + public NetworkConnectionImpl withOrganizationUnit(String organizationUnit) { + if (isInCreateMode()) { + this.innerModel().withOrganizationUnit(organizationUnit); + return this; + } else { + this.updateBody.withOrganizationUnit(organizationUnit); + return this; + } + } + + public NetworkConnectionImpl withDomainUsername(String domainUsername) { + if (isInCreateMode()) { + this.innerModel().withDomainUsername(domainUsername); + return this; + } else { + this.updateBody.withDomainUsername(domainUsername); + return this; + } + } + + public NetworkConnectionImpl withDomainPassword(String domainPassword) { + if (isInCreateMode()) { + this.innerModel().withDomainPassword(domainPassword); + return this; + } else { + this.updateBody.withDomainPassword(domainPassword); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionsClientImpl.java new file mode 100644 index 000000000000..416f137474ce --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionsClientImpl.java @@ -0,0 +1,2252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.NetworkConnectionsClient; +import com.azure.resourcemanager.devcenter.fluent.models.HealthCheckStatusDetailsInner; +import com.azure.resourcemanager.devcenter.fluent.models.NetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatusDetailsListResult; +import com.azure.resourcemanager.devcenter.models.NetworkConnectionListResult; +import com.azure.resourcemanager.devcenter.models.NetworkConnectionUpdate; +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 NetworkConnectionsClient. */ +public final class NetworkConnectionsClientImpl implements NetworkConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final NetworkConnectionsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of NetworkConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworkConnectionsClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(NetworkConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientNetworkConnections to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientNetwo") + private interface NetworkConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/networkConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkConnectionName") String networkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkConnectionName") String networkConnectionName, + @BodyParam("application/json") NetworkConnectionInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkConnectionName") String networkConnectionName, + @BodyParam("application/json") NetworkConnectionUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkConnectionName") String networkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}/healthChecks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHealthDetails( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @PathParam("networkConnectionName") String networkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}/healthChecks/latest") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getHealthDetails( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkConnectionName") String networkConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter" + + "/networkConnections/{networkConnectionName}/runHealthChecks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> runHealthChecks( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkConnectionName") String networkConnectionName, + @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); + + @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> listHealthDetailsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + 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 network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists network connections in 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 result of the network connection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists network connections in 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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + return new PagedIterable<>(listAsync(top)); + } + + /** + * Lists network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Context context) { + return new PagedIterable<>(listAsync(top, context)); + } + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + 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 network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the network connection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top)); + } + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, context)); + } + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String networkConnectionName) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String networkConnectionName, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context); + } + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String networkConnectionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkConnectionInner getByResourceGroup(String resourceGroupName, String networkConnectionName) { + return getByResourceGroupAsync(resourceGroupName, networkConnectionName).block(); + } + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String networkConnectionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkConnectionName, context).block(); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + body, + accept, + context); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkConnectionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, networkConnectionName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NetworkConnectionInner.class, + NetworkConnectionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkConnectionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, networkConnectionName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NetworkConnectionInner.class, + NetworkConnectionInner.class, + context); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, networkConnectionName, body).getSyncPoller(); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkConnectionInner> beginCreateOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, networkConnectionName, body, context).getSyncPoller(); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, networkConnectionName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, networkConnectionName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkConnectionInner createOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body) { + return createOrUpdateAsync(resourceGroupName, networkConnectionName, body).block(); + } + + /** + * Creates or updates a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkConnectionInner createOrUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, networkConnectionName, body, context).block(); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + body, + accept, + context); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkConnectionInner> beginUpdateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, networkConnectionName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NetworkConnectionInner.class, + NetworkConnectionInner.class, + this.client.getContext()); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkConnectionInner> beginUpdateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, networkConnectionName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NetworkConnectionInner.class, + NetworkConnectionInner.class, + context); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkConnectionInner> beginUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body) { + return beginUpdateAsync(resourceGroupName, networkConnectionName, body).getSyncPoller(); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network related settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkConnectionInner> beginUpdate( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, networkConnectionName, body, context).getSyncPoller(); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body) { + return beginUpdateAsync(resourceGroupName, networkConnectionName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, networkConnectionName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkConnectionInner update( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body) { + return updateAsync(resourceGroupName, networkConnectionName, body).block(); + } + + /** + * Partially updates a Network Connection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param body Represents network connection. + * @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 network related settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkConnectionInner update( + String resourceGroupName, String networkConnectionName, NetworkConnectionUpdate body, Context context) { + return updateAsync(resourceGroupName, networkConnectionName, body, context).block(); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String networkConnectionName) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String networkConnectionName, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String networkConnectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, networkConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String networkConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, networkConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String networkConnectionName) { + return beginDeleteAsync(resourceGroupName, networkConnectionName).getSyncPoller(); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String networkConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, networkConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String networkConnectionName) { + return beginDeleteAsync(resourceGroupName, networkConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String networkConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, networkConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 networkConnectionName) { + deleteAsync(resourceGroupName, networkConnectionName).block(); + } + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 networkConnectionName, Context context) { + deleteAsync(resourceGroupName, networkConnectionName, context).block(); + } + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHealthDetailsSinglePageAsync( + String resourceGroupName, String networkConnectionName, Integer top) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listHealthDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + networkConnectionName, + 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 health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHealthDetailsSinglePageAsync( + String resourceGroupName, String networkConnectionName, Integer top, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHealthDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + networkConnectionName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHealthDetailsAsync( + String resourceGroupName, String networkConnectionName, Integer top) { + return new PagedFlux<>( + () -> listHealthDetailsSinglePageAsync(resourceGroupName, networkConnectionName, top), + nextLink -> listHealthDetailsNextSinglePageAsync(nextLink)); + } + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 result of the network health check list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHealthDetailsAsync( + String resourceGroupName, String networkConnectionName) { + final Integer top = null; + return new PagedFlux<>( + () -> listHealthDetailsSinglePageAsync(resourceGroupName, networkConnectionName, top), + nextLink -> listHealthDetailsNextSinglePageAsync(nextLink)); + } + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHealthDetailsAsync( + String resourceGroupName, String networkConnectionName, Integer top, Context context) { + return new PagedFlux<>( + () -> listHealthDetailsSinglePageAsync(resourceGroupName, networkConnectionName, top, context), + nextLink -> listHealthDetailsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 result of the network health check list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName) { + final Integer top = null; + return new PagedIterable<>(listHealthDetailsAsync(resourceGroupName, networkConnectionName, top)); + } + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName, Integer top, Context context) { + return new PagedIterable<>(listHealthDetailsAsync(resourceGroupName, networkConnectionName, top, context)); + } + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getHealthDetailsWithResponseAsync( + String resourceGroupName, String networkConnectionName) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getHealthDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getHealthDetailsWithResponseAsync( + String resourceGroupName, String networkConnectionName, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getHealthDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context); + } + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getHealthDetailsAsync( + String resourceGroupName, String networkConnectionName) { + return getHealthDetailsWithResponseAsync(resourceGroupName, networkConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthCheckStatusDetailsInner getHealthDetails(String resourceGroupName, String networkConnectionName) { + return getHealthDetailsAsync(resourceGroupName, networkConnectionName).block(); + } + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getHealthDetailsWithResponse( + String resourceGroupName, String networkConnectionName, Context context) { + return getHealthDetailsWithResponseAsync(resourceGroupName, networkConnectionName, context).block(); + } + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runHealthChecksWithResponseAsync( + String resourceGroupName, String networkConnectionName) { + 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .runHealthChecks( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runHealthChecksWithResponseAsync( + String resourceGroupName, String networkConnectionName, 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 (networkConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .runHealthChecks( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + networkConnectionName, + accept, + context); + } + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runHealthChecksAsync(String resourceGroupName, String networkConnectionName) { + return runHealthChecksWithResponseAsync(resourceGroupName, networkConnectionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 runHealthChecks(String resourceGroupName, String networkConnectionName) { + runHealthChecksAsync(resourceGroupName, networkConnectionName).block(); + } + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response runHealthChecksWithResponse( + String resourceGroupName, String networkConnectionName, Context context) { + return runHealthChecksWithResponseAsync(resourceGroupName, networkConnectionName, 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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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)); + } + + /** + * 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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 result of the network connection list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 result of the network health check list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHealthDetailsNextSinglePageAsync(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.listHealthDetailsNext(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 result of the network health check list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHealthDetailsNextSinglePageAsync( + 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 + .listHealthDetailsNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionsImpl.java new file mode 100644 index 000000000000..72fa60875c99 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/NetworkConnectionsImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.NetworkConnectionsClient; +import com.azure.resourcemanager.devcenter.fluent.models.HealthCheckStatusDetailsInner; +import com.azure.resourcemanager.devcenter.fluent.models.NetworkConnectionInner; +import com.azure.resourcemanager.devcenter.models.HealthCheckStatusDetails; +import com.azure.resourcemanager.devcenter.models.NetworkConnection; +import com.azure.resourcemanager.devcenter.models.NetworkConnections; + +public final class NetworkConnectionsImpl implements NetworkConnections { + private static final ClientLogger LOGGER = new ClientLogger(NetworkConnectionsImpl.class); + + private final NetworkConnectionsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public NetworkConnectionsImpl( + NetworkConnectionsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new NetworkConnectionImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(top, context); + return Utils.mapPage(inner, inner1 -> new NetworkConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new NetworkConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, top, context); + return Utils.mapPage(inner, inner1 -> new NetworkConnectionImpl(inner1, this.manager())); + } + + public NetworkConnection getByResourceGroup(String resourceGroupName, String networkConnectionName) { + NetworkConnectionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, networkConnectionName); + if (inner != null) { + return new NetworkConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String networkConnectionName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, networkConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NetworkConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String networkConnectionName) { + this.serviceClient().delete(resourceGroupName, networkConnectionName); + } + + public void delete(String resourceGroupName, String networkConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, networkConnectionName, context); + } + + public PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName) { + PagedIterable inner = + this.serviceClient().listHealthDetails(resourceGroupName, networkConnectionName); + return Utils.mapPage(inner, inner1 -> new HealthCheckStatusDetailsImpl(inner1, this.manager())); + } + + public PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listHealthDetails(resourceGroupName, networkConnectionName, top, context); + return Utils.mapPage(inner, inner1 -> new HealthCheckStatusDetailsImpl(inner1, this.manager())); + } + + public HealthCheckStatusDetails getHealthDetails(String resourceGroupName, String networkConnectionName) { + HealthCheckStatusDetailsInner inner = + this.serviceClient().getHealthDetails(resourceGroupName, networkConnectionName); + if (inner != null) { + return new HealthCheckStatusDetailsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getHealthDetailsWithResponse( + String resourceGroupName, String networkConnectionName, Context context) { + Response inner = + this.serviceClient().getHealthDetailsWithResponse(resourceGroupName, networkConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HealthCheckStatusDetailsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void runHealthChecks(String resourceGroupName, String networkConnectionName) { + this.serviceClient().runHealthChecks(resourceGroupName, networkConnectionName); + } + + public Response runHealthChecksWithResponse( + String resourceGroupName, String networkConnectionName, Context context) { + return this.serviceClient().runHealthChecksWithResponse(resourceGroupName, networkConnectionName, context); + } + + public NetworkConnection 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 networkConnectionName = Utils.getValueFromIdByName(id, "networkConnections"); + if (networkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'networkConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkConnectionName, 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 networkConnectionName = Utils.getValueFromIdByName(id, "networkConnections"); + if (networkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'networkConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkConnectionName, 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 networkConnectionName = Utils.getValueFromIdByName(id, "networkConnections"); + if (networkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'networkConnections'.", id))); + } + this.delete(resourceGroupName, networkConnectionName, 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 networkConnectionName = Utils.getValueFromIdByName(id, "networkConnections"); + if (networkConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'networkConnections'.", id))); + } + this.delete(resourceGroupName, networkConnectionName, context); + } + + private NetworkConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public NetworkConnectionImpl define(String name) { + return new NetworkConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationImpl.java new file mode 100644 index 000000000000..729ce4c1bebc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationImpl.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.devcenter.implementation; + +import com.azure.resourcemanager.devcenter.fluent.models.OperationInner; +import com.azure.resourcemanager.devcenter.models.ActionType; +import com.azure.resourcemanager.devcenter.models.Operation; +import com.azure.resourcemanager.devcenter.models.OperationDisplay; +import com.azure.resourcemanager.devcenter.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager 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.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusImpl.java new file mode 100644 index 000000000000..0c4b77ca5d3a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusImpl.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.devcenter.implementation; + +import com.azure.resourcemanager.devcenter.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.devcenter.models.OperationStatus; +import com.azure.resourcemanager.devcenter.models.OperationStatusError; +import java.time.OffsetDateTime; + +public final class OperationStatusImpl implements OperationStatus { + private OperationStatusInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + OperationStatusImpl( + OperationStatusInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Float percentComplete() { + return this.innerModel().percentComplete(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationStatusError error() { + return this.innerModel().error(); + } + + public OperationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusesClientImpl.java new file mode 100644 index 000000000000..ca99c868231f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusesClientImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.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.resourcemanager.devcenter.fluent.OperationStatusesClient; +import com.azure.resourcemanager.devcenter.fluent.models.OperationStatusInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public final class OperationStatusesClientImpl implements OperationStatusesClient { + /** The proxy service used to perform REST calls. */ + private final OperationStatusesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of OperationStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusesClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientOperationStatuses to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientOpera") + private interface OperationStatusesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/operationStatuses" + + "/{operationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String operationId) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String operationId, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String operationId) { + return getWithResponseAsync(location, operationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusInner get(String location, String operationId) { + return getAsync(location, operationId).block(); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String operationId, Context context) { + return getWithResponseAsync(location, operationId, context).block(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusesImpl.java new file mode 100644 index 000000000000..0cfccce8f840 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationStatusesImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.OperationStatusesClient; +import com.azure.resourcemanager.devcenter.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.devcenter.models.OperationStatus; +import com.azure.resourcemanager.devcenter.models.OperationStatuses; + +public final class OperationStatusesImpl implements OperationStatuses { + private static final ClientLogger LOGGER = new ClientLogger(OperationStatusesImpl.class); + + private final OperationStatusesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public OperationStatusesImpl( + OperationStatusesClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationStatus get(String location, String operationId) { + OperationStatusInner inner = this.serviceClient().get(location, operationId); + if (inner != null) { + return new OperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String operationId, Context context) { + Response inner = this.serviceClient().getWithResponse(location, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationStatusesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..9d4e37fb5e0d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.resourcemanager.devcenter.fluent.OperationsClient; +import com.azure.resourcemanager.devcenter.fluent.models.OperationInner; +import com.azure.resourcemanager.devcenter.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientOpera") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DevCenter/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @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> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available resource provider 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(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 resource provider 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(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 resource provider 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 as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedIterable}. + */ + @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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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 + .listNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationsImpl.java new file mode 100644 index 000000000000..615ffa16b441 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/OperationsImpl.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.devcenter.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.devcenter.fluent.OperationsClient; +import com.azure.resourcemanager.devcenter.fluent.models.OperationInner; +import com.azure.resourcemanager.devcenter.models.Operation; +import com.azure.resourcemanager.devcenter.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolImpl.java new file mode 100644 index 000000000000..02a3f79b2471 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolImpl.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.PoolInner; +import com.azure.resourcemanager.devcenter.models.LicenseType; +import com.azure.resourcemanager.devcenter.models.LocalAdminStatus; +import com.azure.resourcemanager.devcenter.models.Pool; +import com.azure.resourcemanager.devcenter.models.PoolUpdate; +import java.util.Collections; +import java.util.Map; + +public final class PoolImpl implements Pool, Pool.Definition, Pool.Update { + private PoolInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager 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 provisioningState() { + return this.innerModel().provisioningState(); + } + + public String devBoxDefinitionName() { + return this.innerModel().devBoxDefinitionName(); + } + + public String networkConnectionName() { + return this.innerModel().networkConnectionName(); + } + + public LicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public LocalAdminStatus localAdministrator() { + return this.innerModel().localAdministrator(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String projectName; + + private String poolName; + + private PoolUpdate updateBody; + + public PoolImpl withExistingProject(String resourceGroupName, String projectName) { + this.resourceGroupName = resourceGroupName; + this.projectName = projectName; + return this; + } + + public Pool create() { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .createOrUpdate(resourceGroupName, projectName, poolName, this.innerModel(), Context.NONE); + return this; + } + + public Pool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .createOrUpdate(resourceGroupName, projectName, poolName, this.innerModel(), context); + return this; + } + + PoolImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new PoolInner(); + this.serviceManager = serviceManager; + this.poolName = name; + } + + public PoolImpl update() { + this.updateBody = new PoolUpdate(); + return this; + } + + public Pool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .update(resourceGroupName, projectName, poolName, updateBody, Context.NONE); + return this; + } + + public Pool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .update(resourceGroupName, projectName, poolName, updateBody, context); + return this; + } + + PoolImpl(PoolInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.projectName = Utils.getValueFromIdByName(innerObject.id(), "projects"); + this.poolName = Utils.getValueFromIdByName(innerObject.id(), "pools"); + } + + public Pool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .getWithResponse(resourceGroupName, projectName, poolName, Context.NONE) + .getValue(); + return this; + } + + public Pool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .getWithResponse(resourceGroupName, projectName, poolName, context) + .getValue(); + return this; + } + + public PoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public PoolImpl withDevBoxDefinitionName(String devBoxDefinitionName) { + if (isInCreateMode()) { + this.innerModel().withDevBoxDefinitionName(devBoxDefinitionName); + return this; + } else { + this.updateBody.withDevBoxDefinitionName(devBoxDefinitionName); + return this; + } + } + + public PoolImpl withNetworkConnectionName(String networkConnectionName) { + if (isInCreateMode()) { + this.innerModel().withNetworkConnectionName(networkConnectionName); + return this; + } else { + this.updateBody.withNetworkConnectionName(networkConnectionName); + return this; + } + } + + public PoolImpl withLicenseType(LicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateBody.withLicenseType(licenseType); + return this; + } + } + + public PoolImpl withLocalAdministrator(LocalAdminStatus localAdministrator) { + if (isInCreateMode()) { + this.innerModel().withLocalAdministrator(localAdministrator); + return this; + } else { + this.updateBody.withLocalAdministrator(localAdministrator); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolsClientImpl.java new file mode 100644 index 000000000000..8ddfb3bfd028 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolsClientImpl.java @@ -0,0 +1,1406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.PoolsClient; +import com.azure.resourcemanager.devcenter.fluent.models.PoolInner; +import com.azure.resourcemanager.devcenter.models.PoolListResult; +import com.azure.resourcemanager.devcenter.models.PoolUpdate; +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 PoolsClient. */ +public final class PoolsClientImpl implements PoolsClient { + /** The proxy service used to perform REST calls. */ + private final PoolsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of PoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PoolsClientImpl(DevCenterClientImpl client) { + this.service = RestProxy.create(PoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientPools to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientPools") + private interface PoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProject( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @BodyParam("application/json") PoolInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @BodyParam("application/json") PoolUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProjectNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectSinglePageAsync( + String resourceGroupName, String projectName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + 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 pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectSinglePageAsync( + String resourceGroupName, String projectName, Integer top, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByProject( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync(String resourceGroupName, String projectName, Integer top) { + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listByProjectNextSinglePageAsync(nextLink)); + } + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the machine pool list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listByProjectNextSinglePageAsync(nextLink)); + } + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProjectAsync( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByProjectSinglePageAsync(resourceGroupName, projectName, top, context), + nextLink -> listByProjectNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the machine pool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProject(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedIterable<>(listByProjectAsync(resourceGroupName, projectName, top)); + } + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedIterable<>(listByProjectAsync(resourceGroupName, projectName, top, context)); + } + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String projectName, String poolName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String projectName, String poolName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + accept, + context); + } + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String projectName, String poolName) { + return getWithResponseAsync(resourceGroupName, projectName, poolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner get(String resourceGroupName, String projectName, String poolName) { + return getAsync(resourceGroupName, projectName, poolName).block(); + } + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String projectName, String poolName, Context context) { + return getWithResponseAsync(resourceGroupName, projectName, poolName, context).block(); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String projectName, String poolName, PoolInner body) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String projectName, String poolName, PoolInner body, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + body, + accept, + context); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String projectName, String poolName, PoolInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, projectName, poolName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PoolInner.class, PoolInner.class, this.client.getContext()); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String projectName, String poolName, PoolInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, projectName, poolName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PoolInner.class, PoolInner.class, context); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PoolInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, String poolName, PoolInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, body).getSyncPoller(); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PoolInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, String poolName, PoolInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, body, context).getSyncPoller(); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String projectName, String poolName, PoolInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String projectName, String poolName, PoolInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner createOrUpdate(String resourceGroupName, String projectName, String poolName, PoolInner body) { + return createOrUpdateAsync(resourceGroupName, projectName, poolName, body).block(); + } + + /** + * Creates or updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner createOrUpdate( + String resourceGroupName, String projectName, String poolName, PoolInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, projectName, poolName, body, context).block(); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String projectName, String poolName, PoolUpdate body) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String projectName, String poolName, PoolUpdate body, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + body, + accept, + context); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PoolInner> beginUpdateAsync( + String resourceGroupName, String projectName, String poolName, PoolUpdate body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, projectName, poolName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PoolInner.class, PoolInner.class, this.client.getContext()); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PoolInner> beginUpdateAsync( + String resourceGroupName, String projectName, String poolName, PoolUpdate body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, projectName, poolName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PoolInner.class, PoolInner.class, context); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PoolInner> beginUpdate( + String resourceGroupName, String projectName, String poolName, PoolUpdate body) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, body).getSyncPoller(); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PoolInner> beginUpdate( + String resourceGroupName, String projectName, String poolName, PoolUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, body, context).getSyncPoller(); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String projectName, String poolName, PoolUpdate body) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String projectName, String poolName, PoolUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner update(String resourceGroupName, String projectName, String poolName, PoolUpdate body) { + return updateAsync(resourceGroupName, projectName, poolName, body).block(); + } + + /** + * Partially updates a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param body Represents a machine pool. + * @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 pool of Virtual Machines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner update( + String resourceGroupName, String projectName, String poolName, PoolUpdate body, Context context) { + return updateAsync(resourceGroupName, projectName, poolName, body, context).block(); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String projectName, String poolName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String projectName, String poolName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + accept, + context); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String projectName, String poolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, projectName, poolName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String projectName, String poolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, projectName, poolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String projectName, String poolName) { + return beginDeleteAsync(resourceGroupName, projectName, poolName).getSyncPoller(); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String projectName, String poolName, Context context) { + return beginDeleteAsync(resourceGroupName, projectName, poolName, context).getSyncPoller(); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName, String poolName) { + return beginDeleteAsync(resourceGroupName, projectName, poolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName, String poolName, Context context) { + return beginDeleteAsync(resourceGroupName, projectName, poolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 projectName, String poolName) { + deleteAsync(resourceGroupName, projectName, poolName).block(); + } + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 projectName, String poolName, Context context) { + deleteAsync(resourceGroupName, projectName, poolName, 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 results of the machine pool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectNextSinglePageAsync(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.listByProjectNext(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 results of the machine pool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProjectNextSinglePageAsync(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 + .listByProjectNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolsImpl.java new file mode 100644 index 000000000000..ff8fbfb2e59c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/PoolsImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.PoolsClient; +import com.azure.resourcemanager.devcenter.fluent.models.PoolInner; +import com.azure.resourcemanager.devcenter.models.Pool; +import com.azure.resourcemanager.devcenter.models.Pools; + +public final class PoolsImpl implements Pools { + private static final ClientLogger LOGGER = new ClientLogger(PoolsImpl.class); + + private final PoolsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public PoolsImpl(PoolsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByProject(String resourceGroupName, String projectName) { + PagedIterable inner = this.serviceClient().listByProject(resourceGroupName, projectName); + return Utils.mapPage(inner, inner1 -> new PoolImpl(inner1, this.manager())); + } + + public PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByProject(resourceGroupName, projectName, top, context); + return Utils.mapPage(inner, inner1 -> new PoolImpl(inner1, this.manager())); + } + + public Pool get(String resourceGroupName, String projectName, String poolName) { + PoolInner inner = this.serviceClient().get(resourceGroupName, projectName, poolName); + if (inner != null) { + return new PoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String projectName, String poolName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, projectName, poolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String projectName, String poolName) { + this.serviceClient().delete(resourceGroupName, projectName, poolName); + } + + public void delete(String resourceGroupName, String projectName, String poolName, Context context) { + this.serviceClient().delete(resourceGroupName, projectName, poolName, context); + } + + public Pool 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, poolName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, poolName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + this.delete(resourceGroupName, projectName, poolName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + this.delete(resourceGroupName, projectName, poolName, context); + } + + private PoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public PoolImpl define(String name) { + return new PoolImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypeImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypeImpl.java new file mode 100644 index 000000000000..f30cb1a9a94f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypeImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentType; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdate; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import java.util.Collections; +import java.util.Map; + +public final class ProjectEnvironmentTypeImpl + implements ProjectEnvironmentType, ProjectEnvironmentType.Definition, ProjectEnvironmentType.Update { + private ProjectEnvironmentTypeInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String deploymentTargetId() { + return this.innerModel().deploymentTargetId(); + } + + public EnableStatus status() { + return this.innerModel().status(); + } + + public ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment() { + return this.innerModel().creatorRoleAssignment(); + } + + public Map userRoleAssignments() { + Map inner = this.innerModel().userRoleAssignments(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ProjectEnvironmentTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String projectName; + + private String environmentTypeName; + + private ProjectEnvironmentTypeUpdate updateBody; + + public ProjectEnvironmentTypeImpl withExistingProject(String resourceGroupName, String projectName) { + this.resourceGroupName = resourceGroupName; + this.projectName = projectName; + return this; + } + + public ProjectEnvironmentType create() { + this.innerObject = + serviceManager + .serviceClient() + .getProjectEnvironmentTypes() + .createOrUpdateWithResponse( + resourceGroupName, projectName, environmentTypeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ProjectEnvironmentType create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjectEnvironmentTypes() + .createOrUpdateWithResponse( + resourceGroupName, projectName, environmentTypeName, this.innerModel(), context) + .getValue(); + return this; + } + + ProjectEnvironmentTypeImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new ProjectEnvironmentTypeInner(); + this.serviceManager = serviceManager; + this.environmentTypeName = name; + } + + public ProjectEnvironmentTypeImpl update() { + this.updateBody = new ProjectEnvironmentTypeUpdate(); + return this; + } + + public ProjectEnvironmentType apply() { + this.innerObject = + serviceManager + .serviceClient() + .getProjectEnvironmentTypes() + .updateWithResponse(resourceGroupName, projectName, environmentTypeName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public ProjectEnvironmentType apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjectEnvironmentTypes() + .updateWithResponse(resourceGroupName, projectName, environmentTypeName, updateBody, context) + .getValue(); + return this; + } + + ProjectEnvironmentTypeImpl( + ProjectEnvironmentTypeInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.projectName = Utils.getValueFromIdByName(innerObject.id(), "projects"); + this.environmentTypeName = Utils.getValueFromIdByName(innerObject.id(), "environmentTypes"); + } + + public ProjectEnvironmentType refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getProjectEnvironmentTypes() + .getWithResponse(resourceGroupName, projectName, environmentTypeName, Context.NONE) + .getValue(); + return this; + } + + public ProjectEnvironmentType refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjectEnvironmentTypes() + .getWithResponse(resourceGroupName, projectName, environmentTypeName, context) + .getValue(); + return this; + } + + public ProjectEnvironmentTypeImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ProjectEnvironmentTypeImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ProjectEnvironmentTypeImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public ProjectEnvironmentTypeImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateBody.withIdentity(identity); + return this; + } + } + + public ProjectEnvironmentTypeImpl withDeploymentTargetId(String deploymentTargetId) { + if (isInCreateMode()) { + this.innerModel().withDeploymentTargetId(deploymentTargetId); + return this; + } else { + this.updateBody.withDeploymentTargetId(deploymentTargetId); + return this; + } + } + + public ProjectEnvironmentTypeImpl withStatus(EnableStatus status) { + if (isInCreateMode()) { + this.innerModel().withStatus(status); + return this; + } else { + this.updateBody.withStatus(status); + return this; + } + } + + public ProjectEnvironmentTypeImpl withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment) { + if (isInCreateMode()) { + this.innerModel().withCreatorRoleAssignment(creatorRoleAssignment); + return this; + } else { + this.updateBody.withCreatorRoleAssignment(creatorRoleAssignment); + return this; + } + } + + public ProjectEnvironmentTypeImpl withUserRoleAssignments( + Map userRoleAssignments) { + if (isInCreateMode()) { + this.innerModel().withUserRoleAssignments(userRoleAssignments); + return this; + } else { + this.updateBody.withUserRoleAssignments(userRoleAssignments); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypesClientImpl.java new file mode 100644 index 000000000000..d27a9401efa5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypesClientImpl.java @@ -0,0 +1,1122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.devcenter.fluent.ProjectEnvironmentTypesClient; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeListResult; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProjectEnvironmentTypesClient. */ +public final class ProjectEnvironmentTypesClientImpl implements ProjectEnvironmentTypesClient { + /** The proxy service used to perform REST calls. */ + private final ProjectEnvironmentTypesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of ProjectEnvironmentTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProjectEnvironmentTypesClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy + .create(ProjectEnvironmentTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientProjectEnvironmentTypes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientProje") + private interface ProjectEnvironmentTypesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/environmentTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("environmentTypeName") String environmentTypeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("environmentTypeName") String environmentTypeName, + @BodyParam("application/json") ProjectEnvironmentTypeInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("environmentTypeName") String environmentTypeName, + @BodyParam("application/json") ProjectEnvironmentTypeUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/environmentTypes/{environmentTypeName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("environmentTypeName") String environmentTypeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String projectName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + 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 environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String projectName, Integer top, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String projectName, Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 result of the project environment type list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, projectName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, projectName, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 result of the project environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String projectName) { + final Integer top = null; + return new PagedIterable<>(listAsync(resourceGroupName, projectName, top)); + } + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String projectName, Integer top, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, projectName, top, context)); + } + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String projectName, String environmentTypeName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String projectName, String environmentTypeName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + accept, + context); + } + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String projectName, String environmentTypeName) { + return getWithResponseAsync(resourceGroupName, projectName, environmentTypeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectEnvironmentTypeInner get(String resourceGroupName, String projectName, String environmentTypeName) { + return getAsync(resourceGroupName, projectName, environmentTypeName).block(); + } + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context) { + return getWithResponseAsync(resourceGroupName, projectName, environmentTypeName, context).block(); + } + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeInner body) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String projectName, + String environmentTypeName, + ProjectEnvironmentTypeInner body, + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + body, + accept, + context); + } + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, projectName, environmentTypeName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectEnvironmentTypeInner createOrUpdate( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeInner body) { + return createOrUpdateAsync(resourceGroupName, projectName, environmentTypeName, body).block(); + } + + /** + * Creates or updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Represents a Project Environment Type. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String projectName, + String environmentTypeName, + ProjectEnvironmentTypeInner body, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, projectName, environmentTypeName, body, context) + .block(); + } + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeUpdate body) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String projectName, + String environmentTypeName, + ProjectEnvironmentTypeUpdate body, + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + body, + accept, + context); + } + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeUpdate body) { + return updateWithResponseAsync(resourceGroupName, projectName, environmentTypeName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectEnvironmentTypeInner update( + String resourceGroupName, String projectName, String environmentTypeName, ProjectEnvironmentTypeUpdate body) { + return updateAsync(resourceGroupName, projectName, environmentTypeName, body).block(); + } + + /** + * Partially updates a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param body Updatable project environment type properties. + * @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 represents an environment type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String projectName, + String environmentTypeName, + ProjectEnvironmentTypeUpdate body, + Context context) { + return updateWithResponseAsync(resourceGroupName, projectName, environmentTypeName, body, context).block(); + } + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String projectName, String environmentTypeName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String projectName, String environmentTypeName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (environmentTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + environmentTypeName, + accept, + context); + } + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName, String environmentTypeName) { + return deleteWithResponseAsync(resourceGroupName, projectName, environmentTypeName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 projectName, String environmentTypeName) { + deleteAsync(resourceGroupName, projectName, environmentTypeName).block(); + } + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context) { + return deleteWithResponseAsync(resourceGroupName, projectName, environmentTypeName, 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 result of the project environment type list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 result of the project environment type list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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 + .listNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypesImpl.java new file mode 100644 index 000000000000..177410ef22ec --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectEnvironmentTypesImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.ProjectEnvironmentTypesClient; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentType; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypes; + +public final class ProjectEnvironmentTypesImpl implements ProjectEnvironmentTypes { + private static final ClientLogger LOGGER = new ClientLogger(ProjectEnvironmentTypesImpl.class); + + private final ProjectEnvironmentTypesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public ProjectEnvironmentTypesImpl( + ProjectEnvironmentTypesClient innerClient, + com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String projectName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, projectName); + return Utils.mapPage(inner, inner1 -> new ProjectEnvironmentTypeImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String projectName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, projectName, top, context); + return Utils.mapPage(inner, inner1 -> new ProjectEnvironmentTypeImpl(inner1, this.manager())); + } + + public ProjectEnvironmentType get(String resourceGroupName, String projectName, String environmentTypeName) { + ProjectEnvironmentTypeInner inner = + this.serviceClient().get(resourceGroupName, projectName, environmentTypeName); + if (inner != null) { + return new ProjectEnvironmentTypeImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, projectName, environmentTypeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProjectEnvironmentTypeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String projectName, String environmentTypeName) { + this.serviceClient().delete(resourceGroupName, projectName, environmentTypeName); + } + + public Response deleteWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, projectName, environmentTypeName, context); + } + + public ProjectEnvironmentType 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, environmentTypeName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, environmentTypeName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + this.deleteWithResponse(resourceGroupName, projectName, environmentTypeName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String environmentTypeName = Utils.getValueFromIdByName(id, "environmentTypes"); + if (environmentTypeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'environmentTypes'.", id))); + } + return this.deleteWithResponse(resourceGroupName, projectName, environmentTypeName, context); + } + + private ProjectEnvironmentTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public ProjectEnvironmentTypeImpl define(String name) { + return new ProjectEnvironmentTypeImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectImpl.java new file mode 100644 index 000000000000..985bad25d0e3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectInner; +import com.azure.resourcemanager.devcenter.models.Project; +import com.azure.resourcemanager.devcenter.models.ProjectUpdate; +import java.util.Collections; +import java.util.Map; + +public final class ProjectImpl implements Project, Project.Definition, Project.Update { + private ProjectInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager 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 provisioningState() { + return this.innerModel().provisioningState(); + } + + public String devCenterId() { + return this.innerModel().devCenterId(); + } + + public String description() { + return this.innerModel().description(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ProjectInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String projectName; + + private ProjectUpdate updateBody; + + public ProjectImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Project create() { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .createOrUpdate(resourceGroupName, projectName, this.innerModel(), Context.NONE); + return this; + } + + public Project create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .createOrUpdate(resourceGroupName, projectName, this.innerModel(), context); + return this; + } + + ProjectImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new ProjectInner(); + this.serviceManager = serviceManager; + this.projectName = name; + } + + public ProjectImpl update() { + this.updateBody = new ProjectUpdate(); + return this; + } + + public Project apply() { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .update(resourceGroupName, projectName, updateBody, Context.NONE); + return this; + } + + public Project apply(Context context) { + this.innerObject = + serviceManager.serviceClient().getProjects().update(resourceGroupName, projectName, updateBody, context); + return this; + } + + ProjectImpl(ProjectInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.projectName = Utils.getValueFromIdByName(innerObject.id(), "projects"); + } + + public Project refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .getByResourceGroupWithResponse(resourceGroupName, projectName, Context.NONE) + .getValue(); + return this; + } + + public Project refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProjects() + .getByResourceGroupWithResponse(resourceGroupName, projectName, context) + .getValue(); + return this; + } + + public ProjectImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ProjectImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ProjectImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public ProjectImpl withDevCenterId(String devCenterId) { + if (isInCreateMode()) { + this.innerModel().withDevCenterId(devCenterId); + return this; + } else { + this.updateBody.withDevCenterId(devCenterId); + return this; + } + } + + public ProjectImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateBody.withDescription(description); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectsClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectsClientImpl.java new file mode 100644 index 000000000000..40cff72bb809 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectsClientImpl.java @@ -0,0 +1,1570 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.ProjectsClient; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectInner; +import com.azure.resourcemanager.devcenter.models.ProjectListResult; +import com.azure.resourcemanager.devcenter.models.ProjectUpdate; +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 ProjectsClient. */ +public final class ProjectsClientImpl implements ProjectsClient { + /** The proxy service used to perform REST calls. */ + private final ProjectsService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of ProjectsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProjectsClientImpl(DevCenterClientImpl client) { + this.service = RestProxy.create(ProjectsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientProjects to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientProje") + private interface ProjectsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/projects") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @BodyParam("application/json") ProjectInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @BodyParam("application/json") ProjectUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @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); + + @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); + } + + /** + * Lists all projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + 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 projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all projects in 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 results of the project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all projects in 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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + return new PagedIterable<>(listAsync(top)); + } + + /** + * Lists all projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Context context) { + return new PagedIterable<>(listAsync(top, context)); + } + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + 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 projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 results of the project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top)); + } + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, context)); + } + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String projectName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String projectName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + accept, + context); + } + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String projectName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, projectName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner getByResourceGroup(String resourceGroupName, String projectName) { + return getByResourceGroupAsync(resourceGroupName, projectName).block(); + } + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String projectName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, projectName, context).block(); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String projectName, ProjectInner body) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String projectName, ProjectInner body, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + body, + accept, + context); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProjectInner> beginCreateOrUpdateAsync( + String resourceGroupName, String projectName, ProjectInner body) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, projectName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProjectInner.class, ProjectInner.class, this.client.getContext()); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProjectInner> beginCreateOrUpdateAsync( + String resourceGroupName, String projectName, ProjectInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, projectName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProjectInner.class, ProjectInner.class, context); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, ProjectInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, body).getSyncPoller(); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginCreateOrUpdate( + String resourceGroupName, String projectName, ProjectInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, body, context).getSyncPoller(); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String projectName, ProjectInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String projectName, ProjectInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner createOrUpdate(String resourceGroupName, String projectName, ProjectInner body) { + return createOrUpdateAsync(resourceGroupName, projectName, body).block(); + } + + /** + * Creates or updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Represents a project. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner createOrUpdate( + String resourceGroupName, String projectName, ProjectInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, projectName, body, context).block(); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String projectName, ProjectUpdate body) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String projectName, ProjectUpdate body, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + body, + accept, + context); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProjectInner> beginUpdateAsync( + String resourceGroupName, String projectName, ProjectUpdate body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, projectName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProjectInner.class, ProjectInner.class, this.client.getContext()); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProjectInner> beginUpdateAsync( + String resourceGroupName, String projectName, ProjectUpdate body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, projectName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProjectInner.class, ProjectInner.class, context); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginUpdate( + String resourceGroupName, String projectName, ProjectUpdate body) { + return beginUpdateAsync(resourceGroupName, projectName, body).getSyncPoller(); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a project resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginUpdate( + String resourceGroupName, String projectName, ProjectUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, projectName, body, context).getSyncPoller(); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String projectName, ProjectUpdate body) { + return beginUpdateAsync(resourceGroupName, projectName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String projectName, ProjectUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, projectName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner update(String resourceGroupName, String projectName, ProjectUpdate body) { + return updateAsync(resourceGroupName, projectName, body).block(); + } + + /** + * Partially updates a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param body Updatable project properties. + * @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 represents a project resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner update(String resourceGroupName, String projectName, ProjectUpdate body, Context context) { + return updateAsync(resourceGroupName, projectName, body, context).block(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String projectName) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String projectName, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + accept, + context); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String projectName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, projectName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String projectName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, projectName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String projectName) { + return beginDeleteAsync(resourceGroupName, projectName).getSyncPoller(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String projectName, Context context) { + return beginDeleteAsync(resourceGroupName, projectName, context).getSyncPoller(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName) { + return beginDeleteAsync(resourceGroupName, projectName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName, Context context) { + return beginDeleteAsync(resourceGroupName, projectName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 projectName) { + deleteAsync(resourceGroupName, projectName).block(); + } + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 projectName, Context context) { + deleteAsync(resourceGroupName, projectName, 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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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)); + } + + /** + * 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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 results of the project list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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)); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectsImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectsImpl.java new file mode 100644 index 000000000000..42d0057d6f34 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ProjectsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.ProjectsClient; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectInner; +import com.azure.resourcemanager.devcenter.models.Project; +import com.azure.resourcemanager.devcenter.models.Projects; + +public final class ProjectsImpl implements Projects { + private static final ClientLogger LOGGER = new ClientLogger(ProjectsImpl.class); + + private final ProjectsClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public ProjectsImpl( + ProjectsClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(top, context); + return Utils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, top, context); + return Utils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public Project getByResourceGroup(String resourceGroupName, String projectName) { + ProjectInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, projectName); + if (inner != null) { + return new ProjectImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String projectName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, projectName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProjectImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String projectName) { + this.serviceClient().delete(resourceGroupName, projectName); + } + + public void delete(String resourceGroupName, String projectName, Context context) { + this.serviceClient().delete(resourceGroupName, projectName, context); + } + + public Project 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, projectName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, projectName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + this.delete(resourceGroupName, projectName, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + this.delete(resourceGroupName, projectName, context); + } + + private ProjectsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public ProjectImpl define(String name) { + return new ProjectImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ScheduleImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ScheduleImpl.java new file mode 100644 index 000000000000..908852dfda23 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/ScheduleImpl.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.devcenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.Schedule; +import com.azure.resourcemanager.devcenter.models.ScheduledFrequency; +import com.azure.resourcemanager.devcenter.models.ScheduledType; + +public final class ScheduleImpl implements Schedule, Schedule.Definition, Schedule.Update { + private ScheduleInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ScheduledType typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public ScheduledFrequency frequency() { + return this.innerModel().frequency(); + } + + public String time() { + return this.innerModel().time(); + } + + public String timeZone() { + return this.innerModel().timeZone(); + } + + public EnableStatus state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ScheduleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String projectName; + + private String poolName; + + private String scheduleName; + + private Integer createTop; + + private Integer updateTop; + + public ScheduleImpl withExistingPool(String resourceGroupName, String projectName, String poolName) { + this.resourceGroupName = resourceGroupName; + this.projectName = projectName; + this.poolName = poolName; + return this; + } + + public Schedule create() { + this.innerObject = + serviceManager + .serviceClient() + .getSchedules() + .createOrUpdate( + resourceGroupName, projectName, poolName, scheduleName, this.innerModel(), createTop, Context.NONE); + return this; + } + + public Schedule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSchedules() + .createOrUpdate( + resourceGroupName, projectName, poolName, scheduleName, this.innerModel(), createTop, context); + return this; + } + + ScheduleImpl(String name, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = new ScheduleInner(); + this.serviceManager = serviceManager; + this.scheduleName = name; + this.createTop = null; + } + + public ScheduleImpl update() { + this.updateTop = null; + return this; + } + + public Schedule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSchedules() + .createOrUpdate( + resourceGroupName, projectName, poolName, scheduleName, this.innerModel(), updateTop, Context.NONE); + return this; + } + + public Schedule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSchedules() + .createOrUpdate( + resourceGroupName, projectName, poolName, scheduleName, this.innerModel(), updateTop, context); + return this; + } + + ScheduleImpl(ScheduleInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.projectName = Utils.getValueFromIdByName(innerObject.id(), "projects"); + this.poolName = Utils.getValueFromIdByName(innerObject.id(), "pools"); + this.scheduleName = Utils.getValueFromIdByName(innerObject.id(), "schedules"); + } + + public Schedule refresh() { + Integer localTop = null; + this.innerObject = + serviceManager + .serviceClient() + .getSchedules() + .getWithResponse(resourceGroupName, projectName, poolName, scheduleName, localTop, Context.NONE) + .getValue(); + return this; + } + + public Schedule refresh(Context context) { + Integer localTop = null; + this.innerObject = + serviceManager + .serviceClient() + .getSchedules() + .getWithResponse(resourceGroupName, projectName, poolName, scheduleName, localTop, context) + .getValue(); + return this; + } + + public ScheduleImpl withTypePropertiesType(ScheduledType typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public ScheduleImpl withFrequency(ScheduledFrequency frequency) { + this.innerModel().withFrequency(frequency); + return this; + } + + public ScheduleImpl withTime(String time) { + this.innerModel().withTime(time); + return this; + } + + public ScheduleImpl withTimeZone(String timeZone) { + this.innerModel().withTimeZone(timeZone); + return this; + } + + public ScheduleImpl withState(EnableStatus state) { + this.innerModel().withState(state); + return this; + } + + public ScheduleImpl withTop(Integer top) { + if (isInCreateMode()) { + this.createTop = top; + return this; + } else { + this.updateTop = top; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SchedulesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SchedulesClientImpl.java new file mode 100644 index 000000000000..8d429770f197 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SchedulesClientImpl.java @@ -0,0 +1,1842 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devcenter.fluent.SchedulesClient; +import com.azure.resourcemanager.devcenter.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devcenter.models.ScheduleListResult; +import com.azure.resourcemanager.devcenter.models.ScheduleUpdate; +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 SchedulesClient. */ +public final class SchedulesClientImpl implements SchedulesClient { + /** The proxy service used to perform REST calls. */ + private final SchedulesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of SchedulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchedulesClientImpl(DevCenterClientImpl client) { + this.service = + RestProxy.create(SchedulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientSchedules to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientSched") + private interface SchedulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}/schedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}/schedules/{scheduleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @PathParam("scheduleName") String scheduleName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}/schedules/{scheduleName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @PathParam("scheduleName") String scheduleName, + @QueryParam("$top") Integer top, + @BodyParam("application/json") ScheduleInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}/schedules/{scheduleName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @PathParam("scheduleName") String scheduleName, + @QueryParam("$top") Integer top, + @BodyParam("application/json") ScheduleUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects" + + "/{projectName}/pools/{poolName}/schedules/{scheduleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("projectName") String projectName, + @PathParam("poolName") String poolName, + @PathParam("scheduleName") String scheduleName, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPoolSinglePageAsync( + String resourceGroupName, String projectName, String poolName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByPool( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + top, + 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 schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPoolSinglePageAsync( + String resourceGroupName, String projectName, String poolName, Integer top, 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPool( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPoolAsync( + String resourceGroupName, String projectName, String poolName, Integer top) { + return new PagedFlux<>( + () -> listByPoolSinglePageAsync(resourceGroupName, projectName, poolName, top), + nextLink -> listByPoolNextSinglePageAsync(nextLink)); + } + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 result of the schedule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPoolAsync(String resourceGroupName, String projectName, String poolName) { + final Integer top = null; + return new PagedFlux<>( + () -> listByPoolSinglePageAsync(resourceGroupName, projectName, poolName, top), + nextLink -> listByPoolNextSinglePageAsync(nextLink)); + } + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPoolAsync( + String resourceGroupName, String projectName, String poolName, Integer top, Context context) { + return new PagedFlux<>( + () -> listByPoolSinglePageAsync(resourceGroupName, projectName, poolName, top, context), + nextLink -> listByPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 result of the schedule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPool(String resourceGroupName, String projectName, String poolName) { + final Integer top = null; + return new PagedIterable<>(listByPoolAsync(resourceGroupName, projectName, poolName, top)); + } + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPool( + String resourceGroupName, String projectName, String poolName, Integer top, Context context) { + return new PagedIterable<>(listByPoolAsync(resourceGroupName, projectName, poolName, top, context)); + } + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + accept, + context); + } + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + return getWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, top) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 schedule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName) { + final Integer top = null; + return getWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, top) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 schedule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner get(String resourceGroupName, String projectName, String poolName, String scheduleName) { + final Integer top = null; + return getAsync(resourceGroupName, projectName, poolName, scheduleName, top).block(); + } + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + return getWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, top, context).block(); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + body, + accept, + context); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ScheduleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, body, top); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ScheduleInner.class, + ScheduleInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ScheduleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ScheduleInner.class, ScheduleInner.class, context); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ScheduleInner> beginCreateOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top) + .getSyncPoller(); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ScheduleInner> beginCreateOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context) + .getSyncPoller(); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 represents a Schedule to execute a task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleInner body) { + final Integer top = null; + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top) { + return createOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top).block(); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleInner body) { + final Integer top = null; + return createOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top).block(); + } + + /** + * Creates or updates a Schedule. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 represents a Schedule to execute a task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleInner body, + Integer top, + Context context) { + return createOrUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context).block(); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + body, + accept, + context); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpdateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, body, top); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpdateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top).getSyncPoller(); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpdate( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context) + .getSyncPoller(); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleUpdate body) { + final Integer top = null; + return beginUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context) { + return beginUpdateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top) { + updateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top).block(); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 update( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleUpdate body) { + final Integer top = null; + updateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top).block(); + } + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context) { + updateAsync(resourceGroupName, projectName, poolName, scheduleName, body, top, context).block(); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + 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 (projectName == null) { + return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (scheduleName == null) { + return Mono.error(new IllegalArgumentException("Parameter scheduleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + projectName, + poolName, + scheduleName, + top, + accept, + context); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, top); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, projectName, poolName, scheduleName, top, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + return beginDeleteAsync(resourceGroupName, projectName, poolName, scheduleName, top).getSyncPoller(); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + return beginDeleteAsync(resourceGroupName, projectName, poolName, scheduleName, top, context).getSyncPoller(); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + return beginDeleteAsync(resourceGroupName, projectName, poolName, scheduleName, top) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String projectName, String poolName, String scheduleName) { + final Integer top = null; + return beginDeleteAsync(resourceGroupName, projectName, poolName, scheduleName, top) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + return beginDeleteAsync(resourceGroupName, projectName, poolName, scheduleName, top, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 projectName, String poolName, String scheduleName, Integer top) { + deleteAsync(resourceGroupName, projectName, poolName, scheduleName, top).block(); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 projectName, String poolName, String scheduleName) { + final Integer top = null; + deleteAsync(resourceGroupName, projectName, poolName, scheduleName, top).block(); + } + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + deleteAsync(resourceGroupName, projectName, poolName, scheduleName, top, 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 result of the schedule list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPoolNextSinglePageAsync(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.listByPoolNext(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 result of the schedule list operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPoolNextSinglePageAsync(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 + .listByPoolNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SchedulesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SchedulesImpl.java new file mode 100644 index 000000000000..0e523396fcd6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SchedulesImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.SchedulesClient; +import com.azure.resourcemanager.devcenter.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devcenter.models.Schedule; +import com.azure.resourcemanager.devcenter.models.ScheduleUpdate; +import com.azure.resourcemanager.devcenter.models.Schedules; + +public final class SchedulesImpl implements Schedules { + private static final ClientLogger LOGGER = new ClientLogger(SchedulesImpl.class); + + private final SchedulesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public SchedulesImpl( + SchedulesClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByPool(String resourceGroupName, String projectName, String poolName) { + PagedIterable inner = this.serviceClient().listByPool(resourceGroupName, projectName, poolName); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable listByPool( + String resourceGroupName, String projectName, String poolName, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().listByPool(resourceGroupName, projectName, poolName, top, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public Schedule get(String resourceGroupName, String projectName, String poolName, String scheduleName) { + ScheduleInner inner = this.serviceClient().get(resourceGroupName, projectName, poolName, scheduleName); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, projectName, poolName, scheduleName, top, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top) { + this.serviceClient().update(resourceGroupName, projectName, poolName, scheduleName, body, top); + } + + public void update( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleUpdate body) { + this.serviceClient().update(resourceGroupName, projectName, poolName, scheduleName, body); + } + + public void update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context) { + this.serviceClient().update(resourceGroupName, projectName, poolName, scheduleName, body, top, context); + } + + public void delete( + String resourceGroupName, String projectName, String poolName, String scheduleName, Integer top) { + this.serviceClient().delete(resourceGroupName, projectName, poolName, scheduleName, top); + } + + public void delete(String resourceGroupName, String projectName, String poolName, String scheduleName) { + this.serviceClient().delete(resourceGroupName, projectName, poolName, scheduleName); + } + + public void delete( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context) { + this.serviceClient().delete(resourceGroupName, projectName, poolName, scheduleName, top, context); + } + + public Schedule 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + String scheduleName = Utils.getValueFromIdByName(id, "schedules"); + if (scheduleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + Integer localTop = null; + return this + .getWithResponse(resourceGroupName, projectName, poolName, scheduleName, localTop, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Integer top, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + String scheduleName = Utils.getValueFromIdByName(id, "schedules"); + if (scheduleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + return this.getWithResponse(resourceGroupName, projectName, poolName, scheduleName, top, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + String scheduleName = Utils.getValueFromIdByName(id, "schedules"); + if (scheduleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + Integer localTop = null; + this.delete(resourceGroupName, projectName, poolName, scheduleName, localTop, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Integer top, 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 projectName = Utils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + String scheduleName = Utils.getValueFromIdByName(id, "schedules"); + if (scheduleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + this.delete(resourceGroupName, projectName, poolName, scheduleName, top, context); + } + + private SchedulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } + + public ScheduleImpl define(String name) { + return new ScheduleImpl(name, this.manager()); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SkusClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SkusClientImpl.java new file mode 100644 index 000000000000..530cc0933946 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SkusClientImpl.java @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.resourcemanager.devcenter.fluent.SkusClient; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner; +import com.azure.resourcemanager.devcenter.models.SkuListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SkusClient. */ +public final class SkusClientImpl implements SkusClient { + /** The proxy service used to perform REST calls. */ + private final SkusService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of SkusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SkusClientImpl(DevCenterClientImpl client) { + this.service = RestProxy.create(SkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientSkus to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientSkus") + private interface SkusService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @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); + } + + /** + * Lists the Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + 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 Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the Microsoft.DevCenter SKUs available in 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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(top), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(top, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the Microsoft.DevCenter SKUs available in 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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + return new PagedIterable<>(listAsync(top)); + } + + /** + * Lists the Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Context context) { + return new PagedIterable<>(listAsync(top, 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 results of the Microsoft.DevCenter SKU list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 results of the Microsoft.DevCenter SKU list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SkusImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SkusImpl.java new file mode 100644 index 000000000000..f34c1a839fb3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/SkusImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.SkusClient; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner; +import com.azure.resourcemanager.devcenter.models.DevCenterSku; +import com.azure.resourcemanager.devcenter.models.Skus; + +public final class SkusImpl implements Skus { + private static final ClientLogger LOGGER = new ClientLogger(SkusImpl.class); + + private final SkusClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public SkusImpl(SkusClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DevCenterSkuImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(top, context); + return Utils.mapPage(inner, inner1 -> new DevCenterSkuImpl(inner1, this.manager())); + } + + private SkusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsageImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsageImpl.java new file mode 100644 index 000000000000..7f566ad645c0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsageImpl.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.devcenter.implementation; + +import com.azure.resourcemanager.devcenter.fluent.models.UsageInner; +import com.azure.resourcemanager.devcenter.models.Usage; +import com.azure.resourcemanager.devcenter.models.UsageName; +import com.azure.resourcemanager.devcenter.models.UsageUnit; + +public final class UsageImpl implements Usage { + private UsageInner innerObject; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + UsageImpl(UsageInner innerObject, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public Long limit() { + return this.innerModel().limit(); + } + + public UsageUnit unit() { + return this.innerModel().unit(); + } + + public UsageName name() { + return this.innerModel().name(); + } + + public UsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsagesClientImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsagesClientImpl.java new file mode 100644 index 000000000000..9fcc38b850cc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsagesClientImpl.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.resourcemanager.devcenter.fluent.UsagesClient; +import com.azure.resourcemanager.devcenter.fluent.models.UsageInner; +import com.azure.resourcemanager.devcenter.models.ListUsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public final class UsagesClientImpl implements UsagesClient { + /** The proxy service used to perform REST calls. */ + private final UsagesService service; + + /** The service client containing this operation class. */ + private final DevCenterClientImpl client; + + /** + * Initializes an instance of UsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsagesClientImpl(DevCenterClientImpl client) { + this.service = RestProxy.create(UsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevCenterClientUsages to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevCenterClientUsage") + private interface UsagesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String location) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + 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 current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String location, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(location), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(location, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location) { + return new PagedIterable<>(listByLocationAsync(location)); + } + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location, Context context) { + return new PagedIterable<>(listByLocationAsync(location, 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 Core Usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 Core Usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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 + .listByLocationNext(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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsagesImpl.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsagesImpl.java new file mode 100644 index 000000000000..11887db84f98 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/UsagesImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.UsagesClient; +import com.azure.resourcemanager.devcenter.fluent.models.UsageInner; +import com.azure.resourcemanager.devcenter.models.Usage; +import com.azure.resourcemanager.devcenter.models.Usages; + +public final class UsagesImpl implements Usages { + private static final ClientLogger LOGGER = new ClientLogger(UsagesImpl.class); + + private final UsagesClient innerClient; + + private final com.azure.resourcemanager.devcenter.DevCenterManager serviceManager; + + public UsagesImpl(UsagesClient innerClient, com.azure.resourcemanager.devcenter.DevCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String location) { + PagedIterable inner = this.serviceClient().listByLocation(location); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(location, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + private UsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devcenter.DevCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/Utils.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/Utils.java new file mode 100644 index 000000000000..db1f5191bf4b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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.devcenter.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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/package-info.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/implementation/package-info.java new file mode 100644 index 000000000000..32488f7d6edd --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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 DevCenterClient. DevCenter Management API. */ +package com.azure.resourcemanager.devcenter.implementation; diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ActionType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ActionType.java new file mode 100644 index 000000000000..35d556fa28c8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ActionType.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.devcenter.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); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworkConnection.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworkConnection.java new file mode 100644 index 000000000000..b054af3dc57a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworkConnection.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.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner; + +/** An immutable client-side representation of AttachedNetworkConnection. */ +public interface AttachedNetworkConnection { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the networkConnectionId property: The resource ID of the NetworkConnection you want to attach. + * + * @return the networkConnectionId value. + */ + String networkConnectionId(); + + /** + * Gets the networkConnectionLocation property: The geo-location where the NetworkConnection resource specified in + * 'networkConnectionResourceId' property lives. + * + * @return the networkConnectionLocation value. + */ + String networkConnectionLocation(); + + /** + * Gets the healthCheckStatus property: Health check status values. + * + * @return the healthCheckStatus value. + */ + HealthCheckStatus healthCheckStatus(); + + /** + * Gets the domainJoinType property: AAD Join type of the network. This is populated based on the referenced Network + * Connection. + * + * @return the domainJoinType value. + */ + DomainJoinType domainJoinType(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner object. + * + * @return the inner object. + */ + AttachedNetworkConnectionInner innerModel(); + + /** The entirety of the AttachedNetworkConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The AttachedNetworkConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the AttachedNetworkConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the AttachedNetworkConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, devCenterName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @return the next definition stage. + */ + WithCreate withExistingDevcenter(String resourceGroupName, String devCenterName); + } + /** + * The stage of the AttachedNetworkConnection 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.WithNetworkConnectionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + AttachedNetworkConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AttachedNetworkConnection create(Context context); + } + /** The stage of the AttachedNetworkConnection definition allowing to specify networkConnectionId. */ + interface WithNetworkConnectionId { + /** + * Specifies the networkConnectionId property: The resource ID of the NetworkConnection you want to attach.. + * + * @param networkConnectionId The resource ID of the NetworkConnection you want to attach. + * @return the next definition stage. + */ + WithCreate withNetworkConnectionId(String networkConnectionId); + } + } + /** + * Begins update for the AttachedNetworkConnection resource. + * + * @return the stage of resource update. + */ + AttachedNetworkConnection.Update update(); + + /** The template for AttachedNetworkConnection update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AttachedNetworkConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AttachedNetworkConnection apply(Context context); + } + /** The AttachedNetworkConnection update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AttachedNetworkConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AttachedNetworkConnection refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworkListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworkListResult.java new file mode 100644 index 000000000000..f574d1b2241d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworkListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.AttachedNetworkConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the Attached Networks list operation. */ +@Immutable +public final class AttachedNetworkListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworks.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworks.java new file mode 100644 index 000000000000..121a288036c6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/AttachedNetworks.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 AttachedNetworks. */ +public interface AttachedNetworks { + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProject(String resourceGroupName, String projectName); + + /** + * Lists the attached NetworkConnections for a Project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection. + */ + AttachedNetworkConnection getByProject( + String resourceGroupName, String projectName, String attachedNetworkConnectionName); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response}. + */ + Response getByProjectWithResponse( + String resourceGroupName, String projectName, String attachedNetworkConnectionName, Context context); + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists the attached NetworkConnections for a DevCenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Attached Networks list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection. + */ + AttachedNetworkConnection getByDevCenter( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName); + + /** + * Gets an attached NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 an attached NetworkConnection along with {@link Response}. + */ + Response getByDevCenterWithResponse( + String resourceGroupName, String devCenterName, String attachedNetworkConnectionName, Context context); + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 devCenterName, String attachedNetworkConnectionName); + + /** + * Un-attach a NetworkConnection. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param attachedNetworkConnectionName The name of the attached NetworkConnection. + * @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 devCenterName, String attachedNetworkConnectionName, Context context); + + /** + * Gets an attached NetworkConnection. + * + * @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 an attached NetworkConnection along with {@link Response}. + */ + AttachedNetworkConnection getById(String id); + + /** + * Gets an attached NetworkConnection. + * + * @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 an attached NetworkConnection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Un-attach a NetworkConnection. + * + * @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); + + /** + * Un-attach a NetworkConnection. + * + * @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 AttachedNetworkConnection resource. + * + * @param name resource name. + * @return the first stage of the new AttachedNetworkConnection definition. + */ + AttachedNetworkConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Capability.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Capability.java new file mode 100644 index 000000000000..800d5b36b926 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Capability.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A name/value pair to describe a capability. */ +@Immutable +public final class Capability { + /* + * Name of the capability. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Value of the capability. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the name property: Name of the capability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: Value of the capability. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Catalog.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Catalog.java new file mode 100644 index 000000000000..9cccbac83c95 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Catalog.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.CatalogInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Catalog. */ +public interface Catalog { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the lastSyncTime property: When the catalog was last synced. + * + * @return the lastSyncTime value. + */ + OffsetDateTime lastSyncTime(); + + /** + * Gets the gitHub property: Properties for a GitHub catalog type. + * + * @return the gitHub value. + */ + GitCatalog gitHub(); + + /** + * Gets the adoGit property: Properties for an Azure DevOps catalog type. + * + * @return the adoGit value. + */ + GitCatalog adoGit(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.CatalogInner object. + * + * @return the inner object. + */ + CatalogInner innerModel(); + + /** The entirety of the Catalog definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Catalog definition stages. */ + interface DefinitionStages { + /** The first stage of the Catalog definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Catalog definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, devCenterName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @return the next definition stage. + */ + WithCreate withExistingDevcenter(String resourceGroupName, String devCenterName); + } + /** + * The stage of the Catalog 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.WithGitHub, DefinitionStages.WithAdoGit { + /** + * Executes the create request. + * + * @return the created resource. + */ + Catalog create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Catalog create(Context context); + } + /** The stage of the Catalog definition allowing to specify gitHub. */ + interface WithGitHub { + /** + * Specifies the gitHub property: Properties for a GitHub catalog type.. + * + * @param gitHub Properties for a GitHub catalog type. + * @return the next definition stage. + */ + WithCreate withGitHub(GitCatalog gitHub); + } + /** The stage of the Catalog definition allowing to specify adoGit. */ + interface WithAdoGit { + /** + * Specifies the adoGit property: Properties for an Azure DevOps catalog type.. + * + * @param adoGit Properties for an Azure DevOps catalog type. + * @return the next definition stage. + */ + WithCreate withAdoGit(GitCatalog adoGit); + } + } + /** + * Begins update for the Catalog resource. + * + * @return the stage of resource update. + */ + Catalog.Update update(); + + /** The template for Catalog update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithGitHub, UpdateStages.WithAdoGit { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Catalog apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Catalog apply(Context context); + } + /** The Catalog update stages. */ + interface UpdateStages { + /** The stage of the Catalog 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 Catalog update allowing to specify gitHub. */ + interface WithGitHub { + /** + * Specifies the gitHub property: Properties for a GitHub catalog type.. + * + * @param gitHub Properties for a GitHub catalog type. + * @return the next definition stage. + */ + Update withGitHub(GitCatalog gitHub); + } + /** The stage of the Catalog update allowing to specify adoGit. */ + interface WithAdoGit { + /** + * Specifies the adoGit property: Properties for an Azure DevOps catalog type.. + * + * @param adoGit Properties for an Azure DevOps catalog type. + * @return the next definition stage. + */ + Update withAdoGit(GitCatalog adoGit); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Catalog refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Catalog refresh(Context context); + + /** + * Syncs templates for a template source. + * + * @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 sync(); + + /** + * Syncs templates for a template source. + * + * @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 sync(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/CatalogListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/CatalogListResult.java new file mode 100644 index 000000000000..9350bd9b8ca8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/CatalogListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.CatalogInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the catalog list operation. */ +@Immutable +public final class CatalogListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/CatalogUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/CatalogUpdate.java new file mode 100644 index 000000000000..cc6f7e0a5483 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/CatalogUpdate.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.CatalogUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The catalog's properties for partial update. Properties not provided in the update request will not be changed. */ +@Fluent +public final class CatalogUpdate { + /* + * Catalog properties for update. + */ + @JsonProperty(value = "properties") + private CatalogUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the innerProperties property: Catalog properties for update. + * + * @return the innerProperties value. + */ + private CatalogUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CatalogUpdate object itself. + */ + public CatalogUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the gitHub property: Properties for a GitHub catalog type. + * + * @return the gitHub value. + */ + public GitCatalog gitHub() { + return this.innerProperties() == null ? null : this.innerProperties().gitHub(); + } + + /** + * Set the gitHub property: Properties for a GitHub catalog type. + * + * @param gitHub the gitHub value to set. + * @return the CatalogUpdate object itself. + */ + public CatalogUpdate withGitHub(GitCatalog gitHub) { + if (this.innerProperties() == null) { + this.innerProperties = new CatalogUpdateProperties(); + } + this.innerProperties().withGitHub(gitHub); + return this; + } + + /** + * Get the adoGit property: Properties for an Azure DevOps catalog type. + * + * @return the adoGit value. + */ + public GitCatalog adoGit() { + return this.innerProperties() == null ? null : this.innerProperties().adoGit(); + } + + /** + * Set the adoGit property: Properties for an Azure DevOps catalog type. + * + * @param adoGit the adoGit value to set. + * @return the CatalogUpdate object itself. + */ + public CatalogUpdate withAdoGit(GitCatalog adoGit) { + if (this.innerProperties() == null) { + this.innerProperties = new CatalogUpdateProperties(); + } + this.innerProperties().withAdoGit(adoGit); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Catalogs.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Catalogs.java new file mode 100644 index 000000000000..4a74d0457190 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Catalogs.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 Catalogs. */ +public interface Catalogs { + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the catalog list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists catalogs for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the catalog list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog. + */ + Catalog get(String resourceGroupName, String devCenterName, String catalogName); + + /** + * Gets a catalog. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 catalog along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String devCenterName, String catalogName, Context context); + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 devCenterName, String catalogName); + + /** + * Deletes a catalog resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 devCenterName, String catalogName, Context context); + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 sync(String resourceGroupName, String devCenterName, String catalogName); + + /** + * Syncs templates for a template source. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param catalogName The name of the Catalog. + * @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 sync(String resourceGroupName, String devCenterName, String catalogName, Context context); + + /** + * Gets a catalog. + * + * @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 a catalog along with {@link Response}. + */ + Catalog getById(String id); + + /** + * Gets a catalog. + * + * @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 a catalog along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a catalog resource. + * + * @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 a catalog resource. + * + * @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 Catalog resource. + * + * @param name resource name. + * @return the first stage of the new Catalog definition. + */ + Catalog.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinition.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinition.java new file mode 100644 index 000000000000..7b29f5185d1c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinition.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionInner; +import java.util.Map; + +/** An immutable client-side representation of DevBoxDefinition. */ +public interface DevBoxDefinition { + /** + * 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the imageValidationStatus property: Validation status of the configured image. + * + * @return the imageValidationStatus value. + */ + ImageValidationStatus imageValidationStatus(); + + /** + * Gets the imageValidationErrorDetails property: Details for image validator error. Populated when the image + * validation is not successful. + * + * @return the imageValidationErrorDetails value. + */ + ImageValidationErrorDetails imageValidationErrorDetails(); + + /** + * Gets the activeImageReference property: Image reference information for the currently active image (only + * populated during updates). + * + * @return the activeImageReference value. + */ + ImageReference activeImageReference(); + + /** + * Gets the imageReference property: Image reference information. + * + * @return the imageReference value. + */ + ImageReference imageReference(); + + /** + * Gets the sku property: The SKU for Dev Boxes created using this definition. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @return the osStorageType value. + */ + String osStorageType(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionInner object. + * + * @return the inner object. + */ + DevBoxDefinitionInner innerModel(); + + /** The entirety of the DevBoxDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The DevBoxDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the DevBoxDefinition definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DevBoxDefinition 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the DevBoxDefinition definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, devCenterName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @return the next definition stage. + */ + WithCreate withExistingDevcenter(String resourceGroupName, String devCenterName); + } + /** + * The stage of the DevBoxDefinition 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.WithImageReference, + DefinitionStages.WithSku, + DefinitionStages.WithOsStorageType { + /** + * Executes the create request. + * + * @return the created resource. + */ + DevBoxDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DevBoxDefinition create(Context context); + } + /** The stage of the DevBoxDefinition 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 DevBoxDefinition definition allowing to specify imageReference. */ + interface WithImageReference { + /** + * Specifies the imageReference property: Image reference information.. + * + * @param imageReference Image reference information. + * @return the next definition stage. + */ + WithCreate withImageReference(ImageReference imageReference); + } + /** The stage of the DevBoxDefinition definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU for Dev Boxes created using this definition.. + * + * @param sku The SKU for Dev Boxes created using this definition. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the DevBoxDefinition definition allowing to specify osStorageType. */ + interface WithOsStorageType { + /** + * Specifies the osStorageType property: The storage type used for the Operating System disk of Dev Boxes + * created using this definition.. + * + * @param osStorageType The storage type used for the Operating System disk of Dev Boxes created using this + * definition. + * @return the next definition stage. + */ + WithCreate withOsStorageType(String osStorageType); + } + } + /** + * Begins update for the DevBoxDefinition resource. + * + * @return the stage of resource update. + */ + DevBoxDefinition.Update update(); + + /** The template for DevBoxDefinition update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithImageReference, + UpdateStages.WithSku, + UpdateStages.WithOsStorageType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DevBoxDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DevBoxDefinition apply(Context context); + } + /** The DevBoxDefinition update stages. */ + interface UpdateStages { + /** The stage of the DevBoxDefinition 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 DevBoxDefinition update allowing to specify imageReference. */ + interface WithImageReference { + /** + * Specifies the imageReference property: Image reference information.. + * + * @param imageReference Image reference information. + * @return the next definition stage. + */ + Update withImageReference(ImageReference imageReference); + } + /** The stage of the DevBoxDefinition update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU for Dev Boxes created using this definition.. + * + * @param sku The SKU for Dev Boxes created using this definition. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the DevBoxDefinition update allowing to specify osStorageType. */ + interface WithOsStorageType { + /** + * Specifies the osStorageType property: The storage type used for the Operating System disk of Dev Boxes + * created using this definition.. + * + * @param osStorageType The storage type used for the Operating System disk of Dev Boxes created using this + * definition. + * @return the next definition stage. + */ + Update withOsStorageType(String osStorageType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DevBoxDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DevBoxDefinition refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitionListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitionListResult.java new file mode 100644 index 000000000000..ed10afdc7415 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitionListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the Dev Box definition list operation. */ +@Immutable +public final class DevBoxDefinitionListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitionUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitionUpdate.java new file mode 100644 index 000000000000..c3c98483c7a0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitionUpdate.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Partial update of a Dev Box definition resource. */ +@Fluent +public final class DevBoxDefinitionUpdate extends TrackedResourceUpdate { + /* + * Properties of a Dev Box definition to be updated. + */ + @JsonProperty(value = "properties") + private DevBoxDefinitionUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Properties of a Dev Box definition to be updated. + * + * @return the innerProperties value. + */ + private DevBoxDefinitionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevBoxDefinitionUpdate withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the imageReference property: Image reference information. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.innerProperties() == null ? null : this.innerProperties().imageReference(); + } + + /** + * Set the imageReference property: Image reference information. + * + * @param imageReference the imageReference value to set. + * @return the DevBoxDefinitionUpdate object itself. + */ + public DevBoxDefinitionUpdate withImageReference(ImageReference imageReference) { + if (this.innerProperties() == null) { + this.innerProperties = new DevBoxDefinitionUpdateProperties(); + } + this.innerProperties().withImageReference(imageReference); + return this; + } + + /** + * Get the sku property: The SKU for Dev Boxes created using this definition. + * + * @return the sku value. + */ + public Sku sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: The SKU for Dev Boxes created using this definition. + * + * @param sku the sku value to set. + * @return the DevBoxDefinitionUpdate object itself. + */ + public DevBoxDefinitionUpdate withSku(Sku sku) { + if (this.innerProperties() == null) { + this.innerProperties = new DevBoxDefinitionUpdateProperties(); + } + this.innerProperties().withSku(sku); + return this; + } + + /** + * Get the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @return the osStorageType value. + */ + public String osStorageType() { + return this.innerProperties() == null ? null : this.innerProperties().osStorageType(); + } + + /** + * Set the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using + * this definition. + * + * @param osStorageType the osStorageType value to set. + * @return the DevBoxDefinitionUpdate object itself. + */ + public DevBoxDefinitionUpdate withOsStorageType(String osStorageType) { + if (this.innerProperties() == null) { + this.innerProperties = new DevBoxDefinitionUpdateProperties(); + } + this.innerProperties().withOsStorageType(osStorageType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitions.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitions.java new file mode 100644 index 000000000000..814069aca07d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevBoxDefinitions.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 DevBoxDefinitions. */ +public interface DevBoxDefinitions { + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * List Dev Box definitions for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition. + */ + DevBoxDefinition get(String resourceGroupName, String devCenterName, String devBoxDefinitionName); + + /** + * Gets a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String devCenterName, String devBoxDefinitionName, Context context); + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 delete(String resourceGroupName, String devCenterName, String devBoxDefinitionName); + + /** + * Deletes a Dev Box definition. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param devBoxDefinitionName The name of the Dev Box 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 devCenterName, String devBoxDefinitionName, Context context); + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProject(String resourceGroupName, String projectName); + + /** + * List Dev Box definitions configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Dev Box definition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProject( + String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project. + */ + DevBoxDefinition getByProject(String resourceGroupName, String projectName, String devBoxDefinitionName); + + /** + * Gets a Dev Box definition configured for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param devBoxDefinitionName The name of the Dev Box 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 a Dev Box definition configured for a project along with {@link Response}. + */ + Response getByProjectWithResponse( + String resourceGroupName, String projectName, String devBoxDefinitionName, Context context); + + /** + * Gets a Dev Box 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 a Dev Box definition along with {@link Response}. + */ + DevBoxDefinition getById(String id); + + /** + * Gets a Dev Box 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 a Dev Box definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Dev Box 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 a Dev Box 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 DevBoxDefinition resource. + * + * @param name resource name. + * @return the first stage of the new DevBoxDefinition definition. + */ + DevBoxDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenter.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenter.java new file mode 100644 index 000000000000..ded9d099b368 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenter.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterInner; +import java.util.Map; + +/** An immutable client-side representation of DevCenter. */ +public interface DevCenter { + /** + * 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 identity property: Managed identity properties. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.DevCenterInner object. + * + * @return the inner object. + */ + DevCenterInner innerModel(); + + /** The entirety of the DevCenter definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DevCenter definition stages. */ + interface DefinitionStages { + /** The first stage of the DevCenter definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DevCenter 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 DevCenter definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DevCenter 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.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + DevCenter create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DevCenter create(Context context); + } + /** The stage of the DevCenter 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 DevCenter definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity properties. + * + * @param identity Managed identity properties. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + /** + * Begins update for the DevCenter resource. + * + * @return the stage of resource update. + */ + DevCenter.Update update(); + + /** The template for DevCenter update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DevCenter apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DevCenter apply(Context context); + } + /** The DevCenter update stages. */ + interface UpdateStages { + /** The stage of the DevCenter 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 DevCenter update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity properties. + * + * @param identity Managed identity properties. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DevCenter refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DevCenter refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterListResult.java new file mode 100644 index 000000000000..dbc1ee8ccc8e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the list devcenters operation. */ +@Immutable +public final class DevCenterListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterSku.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterSku.java new file mode 100644 index 000000000000..7ea5de1808ba --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterSku.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner; +import java.util.List; + +/** An immutable client-side representation of DevCenterSku. */ +public interface DevCenterSku { + /** + * Gets the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value. + */ + String name(); + + /** + * Gets the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + SkuTier tier(); + + /** + * Gets the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + String size(); + + /** + * Gets the family property: If the service has different generations of hardware, for the same SKU, then that can + * be captured here. + * + * @return the family value. + */ + String family(); + + /** + * Gets the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + Integer capacity(); + + /** + * Gets the resourceType property: The name of the resource type. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the locations property: SKU supported locations. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the capabilities property: Collection of name/value pairs to describe the SKU capabilities. + * + * @return the capabilities value. + */ + List capabilities(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner object. + * + * @return the inner object. + */ + DevCenterSkuInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterUpdate.java new file mode 100644 index 000000000000..9f76b34a8ceb --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenterUpdate.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The devcenter resource for partial updates. Properties not provided in the update request will not be changed. */ +@Fluent +public final class DevCenterUpdate extends TrackedResourceUpdate { + /* + * Managed identity properties + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /** + * Get the identity property: Managed identity properties. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties. + * + * @param identity the identity value to set. + * @return the DevCenterUpdate object itself. + */ + public DevCenterUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public DevCenterUpdate withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenters.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenters.java new file mode 100644 index 000000000000..3358666116bc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DevCenters.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.devcenter.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 DevCenters. */ +public interface DevCenters { + /** + * Lists all devcenters in 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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all devcenters in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Integer top, Context context); + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all devcenters in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the list devcenters operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter. + */ + DevCenter getByResourceGroup(String resourceGroupName, String devCenterName); + + /** + * Gets a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devcenter along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String devCenterName, Context context); + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devCenterName); + + /** + * Deletes a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 devCenterName, Context context); + + /** + * Gets a devcenter. + * + * @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 a devcenter along with {@link Response}. + */ + DevCenter getById(String id); + + /** + * Gets a devcenter. + * + * @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 a devcenter along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a devcenter. + * + * @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 a devcenter. + * + * @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 DevCenter resource. + * + * @param name resource name. + * @return the first stage of the new DevCenter definition. + */ + DevCenter.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DomainJoinType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DomainJoinType.java new file mode 100644 index 000000000000..1370dcb2eef9 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/DomainJoinType.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DomainJoinType. */ +public final class DomainJoinType extends ExpandableStringEnum { + /** Static value HybridAzureADJoin for DomainJoinType. */ + public static final DomainJoinType HYBRID_AZURE_ADJOIN = fromString("HybridAzureADJoin"); + + /** Static value AzureADJoin for DomainJoinType. */ + public static final DomainJoinType AZURE_ADJOIN = fromString("AzureADJoin"); + + /** + * Creates or finds a DomainJoinType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DomainJoinType. + */ + @JsonCreator + public static DomainJoinType fromString(String name) { + return fromString(name, DomainJoinType.class); + } + + /** + * Gets known DomainJoinType values. + * + * @return known DomainJoinType values. + */ + public static Collection values() { + return values(DomainJoinType.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnableStatus.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnableStatus.java new file mode 100644 index 000000000000..81a33c3e24ed --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnableStatus.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EnableStatus. */ +public final class EnableStatus extends ExpandableStringEnum { + /** Static value Enabled for EnableStatus. */ + public static final EnableStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for EnableStatus. */ + public static final EnableStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a EnableStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnableStatus. + */ + @JsonCreator + public static EnableStatus fromString(String name) { + return fromString(name, EnableStatus.class); + } + + /** + * Gets known EnableStatus values. + * + * @return known EnableStatus values. + */ + public static Collection values() { + return values(EnableStatus.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentRole.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentRole.java new file mode 100644 index 000000000000..a8a359ab5f27 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentRole.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A role that can be assigned to a user. */ +@Immutable +public final class EnvironmentRole { + /* + * The common name of the Role Assignment. This is a descriptive name such + * as 'AcrPush'. + */ + @JsonProperty(value = "roleName", access = JsonProperty.Access.WRITE_ONLY) + private String roleName; + + /* + * This is a description of the Role Assignment. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the roleName property: The common name of the Role Assignment. This is a descriptive name such as 'AcrPush'. + * + * @return the roleName value. + */ + public String roleName() { + return this.roleName; + } + + /** + * Get the description property: This is a description of the Role Assignment. + * + * @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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentType.java new file mode 100644 index 000000000000..e6ce5d2ed452 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentType.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner; +import java.util.Map; + +/** An immutable client-side representation of EnvironmentType. */ +public interface EnvironmentType { + /** + * 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 tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner object. + * + * @return the inner object. + */ + EnvironmentTypeInner innerModel(); + + /** The entirety of the EnvironmentType definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The EnvironmentType definition stages. */ + interface DefinitionStages { + /** The first stage of the EnvironmentType definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the EnvironmentType definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, devCenterName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @return the next definition stage. + */ + WithCreate withExistingDevcenter(String resourceGroupName, String devCenterName); + } + /** + * The stage of the EnvironmentType 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + EnvironmentType create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EnvironmentType create(Context context); + } + /** The stage of the EnvironmentType 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); + } + } + /** + * Begins update for the EnvironmentType resource. + * + * @return the stage of resource update. + */ + EnvironmentType.Update update(); + + /** The template for EnvironmentType update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EnvironmentType apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EnvironmentType apply(Context context); + } + /** The EnvironmentType update stages. */ + interface UpdateStages { + /** The stage of the EnvironmentType 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); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EnvironmentType refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EnvironmentType refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypeListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypeListResult.java new file mode 100644 index 000000000000..d5764e78dcfc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypeListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.EnvironmentTypeInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the environment type list operation. */ +@Immutable +public final class EnvironmentTypeListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypeUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypeUpdate.java new file mode 100644 index 000000000000..93104106486f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypeUpdate.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The environment type for partial update. Properties not provided in the update request will not be changed. */ +@Fluent +public final class EnvironmentTypeUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EnvironmentTypeUpdate object itself. + */ + public EnvironmentTypeUpdate 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypes.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypes.java new file mode 100644 index 000000000000..2388c33d5926 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/EnvironmentTypes.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 EnvironmentTypes. */ +public interface EnvironmentTypes { + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 result of the environment type list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists environment types for the devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the environment type list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type. + */ + EnvironmentType get(String resourceGroupName, String devCenterName, String environmentTypeName); + + /** + * Gets an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 an environment type along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context); + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @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 devCenterName, String environmentTypeName); + + /** + * Deletes an environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String devCenterName, String environmentTypeName, Context context); + + /** + * Gets an environment type. + * + * @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 an environment type along with {@link Response}. + */ + EnvironmentType getById(String id); + + /** + * Gets an environment type. + * + * @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 an environment type along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an environment type. + * + * @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 an environment type. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EnvironmentType resource. + * + * @param name resource name. + * @return the first stage of the new EnvironmentType definition. + */ + EnvironmentType.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Galleries.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Galleries.java new file mode 100644 index 000000000000..84c2b493ae67 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Galleries.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 Galleries. */ +public interface Galleries { + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the gallery list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists galleries for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the gallery list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter( + String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery. + */ + Gallery get(String resourceGroupName, String devCenterName, String galleryName); + + /** + * Gets a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 gallery along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, Context context); + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 devCenterName, String galleryName); + + /** + * Deletes a gallery resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 devCenterName, String galleryName, Context context); + + /** + * Gets a gallery. + * + * @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 a gallery along with {@link Response}. + */ + Gallery getById(String id); + + /** + * Gets a gallery. + * + * @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 a gallery along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a gallery resource. + * + * @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 a gallery resource. + * + * @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 Gallery resource. + * + * @param name resource name. + * @return the first stage of the new Gallery definition. + */ + Gallery.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Gallery.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Gallery.java new file mode 100644 index 000000000000..bfbc0b2d5456 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Gallery.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.GalleryInner; + +/** An immutable client-side representation of Gallery. */ +public interface Gallery { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the galleryResourceId property: The resource ID of the backing Azure Compute Gallery. + * + * @return the galleryResourceId value. + */ + String galleryResourceId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.GalleryInner object. + * + * @return the inner object. + */ + GalleryInner innerModel(); + + /** The entirety of the Gallery definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Gallery definition stages. */ + interface DefinitionStages { + /** The first stage of the Gallery definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Gallery definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, devCenterName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @return the next definition stage. + */ + WithCreate withExistingDevcenter(String resourceGroupName, String devCenterName); + } + /** + * The stage of the Gallery 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.WithGalleryResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Gallery create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Gallery create(Context context); + } + /** The stage of the Gallery definition allowing to specify galleryResourceId. */ + interface WithGalleryResourceId { + /** + * Specifies the galleryResourceId property: The resource ID of the backing Azure Compute Gallery.. + * + * @param galleryResourceId The resource ID of the backing Azure Compute Gallery. + * @return the next definition stage. + */ + WithCreate withGalleryResourceId(String galleryResourceId); + } + } + /** + * Begins update for the Gallery resource. + * + * @return the stage of resource update. + */ + Gallery.Update update(); + + /** The template for Gallery update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Gallery apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Gallery apply(Context context); + } + /** The Gallery update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Gallery refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Gallery refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/GalleryListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/GalleryListResult.java new file mode 100644 index 000000000000..7e670d4e6919 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/GalleryListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.GalleryInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the gallery list operation. */ +@Immutable +public final class GalleryListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/GitCatalog.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/GitCatalog.java new file mode 100644 index 000000000000..a4342686326b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/GitCatalog.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for a Git repository catalog. */ +@Fluent +public final class GitCatalog { + /* + * Git URI. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Git branch. + */ + @JsonProperty(value = "branch") + private String branch; + + /* + * A reference to the Key Vault secret containing a security token to + * authenticate to a Git repository. + */ + @JsonProperty(value = "secretIdentifier") + private String secretIdentifier; + + /* + * The folder where the catalog items can be found inside the repository. + */ + @JsonProperty(value = "path") + private String path; + + /** + * Get the uri property: Git URI. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: Git URI. + * + * @param uri the uri value to set. + * @return the GitCatalog object itself. + */ + public GitCatalog withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the branch property: Git branch. + * + * @return the branch value. + */ + public String branch() { + return this.branch; + } + + /** + * Set the branch property: Git branch. + * + * @param branch the branch value to set. + * @return the GitCatalog object itself. + */ + public GitCatalog withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the secretIdentifier property: A reference to the Key Vault secret containing a security token to + * authenticate to a Git repository. + * + * @return the secretIdentifier value. + */ + public String secretIdentifier() { + return this.secretIdentifier; + } + + /** + * Set the secretIdentifier property: A reference to the Key Vault secret containing a security token to + * authenticate to a Git repository. + * + * @param secretIdentifier the secretIdentifier value to set. + * @return the GitCatalog object itself. + */ + public GitCatalog withSecretIdentifier(String secretIdentifier) { + this.secretIdentifier = secretIdentifier; + return this; + } + + /** + * Get the path property: The folder where the catalog items can be found inside the repository. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The folder where the catalog items can be found inside the repository. + * + * @param path the path value to set. + * @return the GitCatalog object itself. + */ + public GitCatalog withPath(String path) { + this.path = path; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheck.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheck.java new file mode 100644 index 000000000000..66e7d2409cac --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheck.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An individual health check item. */ +@Immutable +public final class HealthCheck { + /* + * The status of the health check item. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private HealthCheckStatus status; + + /* + * The display name of this health check item. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Start time of health check item. + */ + @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startDateTime; + + /* + * End time of the health check item. + */ + @JsonProperty(value = "endDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endDateTime; + + /* + * The type of error that occurred during this health check. + */ + @JsonProperty(value = "errorType", access = JsonProperty.Access.WRITE_ONLY) + private String errorType; + + /* + * The recommended action to fix the corresponding error. + */ + @JsonProperty(value = "recommendedAction", access = JsonProperty.Access.WRITE_ONLY) + private String recommendedAction; + + /* + * Additional details about the health check or the recommended action. + */ + @JsonProperty(value = "additionalDetails", access = JsonProperty.Access.WRITE_ONLY) + private String additionalDetails; + + /** + * Get the status property: The status of the health check item. + * + * @return the status value. + */ + public HealthCheckStatus status() { + return this.status; + } + + /** + * Get the displayName property: The display name of this health check item. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the startDateTime property: Start time of health check item. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Get the endDateTime property: End time of the health check item. + * + * @return the endDateTime value. + */ + public OffsetDateTime endDateTime() { + return this.endDateTime; + } + + /** + * Get the errorType property: The type of error that occurred during this health check. + * + * @return the errorType value. + */ + public String errorType() { + return this.errorType; + } + + /** + * Get the recommendedAction property: The recommended action to fix the corresponding error. + * + * @return the recommendedAction value. + */ + public String recommendedAction() { + return this.recommendedAction; + } + + /** + * Get the additionalDetails property: Additional details about the health check or the recommended action. + * + * @return the additionalDetails value. + */ + public String additionalDetails() { + return this.additionalDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatus.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatus.java new file mode 100644 index 000000000000..8bec3ce5b44f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatus.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HealthCheckStatus. */ +public final class HealthCheckStatus extends ExpandableStringEnum { + /** Static value Pending for HealthCheckStatus. */ + public static final HealthCheckStatus PENDING = fromString("Pending"); + + /** Static value Running for HealthCheckStatus. */ + public static final HealthCheckStatus RUNNING = fromString("Running"); + + /** Static value Passed for HealthCheckStatus. */ + public static final HealthCheckStatus PASSED = fromString("Passed"); + + /** Static value Failed for HealthCheckStatus. */ + public static final HealthCheckStatus FAILED = fromString("Failed"); + + /** Static value Warning for HealthCheckStatus. */ + public static final HealthCheckStatus WARNING = fromString("Warning"); + + /** Static value Unknown for HealthCheckStatus. */ + public static final HealthCheckStatus UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a HealthCheckStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthCheckStatus. + */ + @JsonCreator + public static HealthCheckStatus fromString(String name) { + return fromString(name, HealthCheckStatus.class); + } + + /** + * Gets known HealthCheckStatus values. + * + * @return known HealthCheckStatus values. + */ + public static Collection values() { + return values(HealthCheckStatus.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatusDetails.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatusDetails.java new file mode 100644 index 000000000000..8292bafb6eb0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatusDetails.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.fluent.models.HealthCheckStatusDetailsInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of HealthCheckStatusDetails. */ +public interface HealthCheckStatusDetails { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the startDateTime property: Start time of last execution of the health checks. + * + * @return the startDateTime value. + */ + OffsetDateTime startDateTime(); + + /** + * Gets the endDateTime property: End time of last execution of the health checks. + * + * @return the endDateTime value. + */ + OffsetDateTime endDateTime(); + + /** + * Gets the healthChecks property: Details for each health check item. + * + * @return the healthChecks value. + */ + List healthChecks(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.HealthCheckStatusDetailsInner object. + * + * @return the inner object. + */ + HealthCheckStatusDetailsInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatusDetailsListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatusDetailsListResult.java new file mode 100644 index 000000000000..50bd822b54f4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/HealthCheckStatusDetailsListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.HealthCheckStatusDetailsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the network health check list operation. */ +@Immutable +public final class HealthCheckStatusDetailsListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Image.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Image.java new file mode 100644 index 000000000000..b37548d00769 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Image.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.devcenter.models; + +import com.azure.resourcemanager.devcenter.fluent.models.ImageInner; + +/** An immutable client-side representation of Image. */ +public interface Image { + /** + * 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 description property: The description of the image. + * + * @return the description value. + */ + String description(); + + /** + * Gets the publisher property: The publisher of the image. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the offer property: The name of the image offer. + * + * @return the offer value. + */ + String offer(); + + /** + * Gets the sku property: The SKU name for the image. + * + * @return the sku value. + */ + String sku(); + + /** + * Gets the recommendedMachineConfiguration property: The recommended machine configuration to use with the image. + * + * @return the recommendedMachineConfiguration value. + */ + RecommendedMachineConfiguration recommendedMachineConfiguration(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.ImageInner object. + * + * @return the inner object. + */ + ImageInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageListResult.java new file mode 100644 index 000000000000..0d9a7fda1c71 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.ImageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the image list operation. */ +@Immutable +public final class ImageListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageReference.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageReference.java new file mode 100644 index 000000000000..604bbd969aa6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageReference.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Image reference information. */ +@Fluent +public final class ImageReference { + /* + * Image ID, or Image version ID. When Image ID is provided, its latest + * version will be used. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The actual version of the image after use. When id references a gallery + * image latest version, this will indicate the actual version in use. + */ + @JsonProperty(value = "exactVersion", access = JsonProperty.Access.WRITE_ONLY) + private String exactVersion; + + /* + * The image publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * The image offer. + */ + @JsonProperty(value = "offer") + private String offer; + + /* + * The image sku. + */ + @JsonProperty(value = "sku") + private String sku; + + /** + * Get the id property: Image ID, or Image version ID. When Image ID is provided, its latest version will be used. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Image ID, or Image version ID. When Image ID is provided, its latest version will be used. + * + * @param id the id value to set. + * @return the ImageReference object itself. + */ + public ImageReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the exactVersion property: The actual version of the image after use. When id references a gallery image + * latest version, this will indicate the actual version in use. + * + * @return the exactVersion value. + */ + public String exactVersion() { + return this.exactVersion; + } + + /** + * Get the publisher property: The image publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The image publisher. + * + * @param publisher the publisher value to set. + * @return the ImageReference object itself. + */ + public ImageReference withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: The image offer. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: The image offer. + * + * @param offer the offer value to set. + * @return the ImageReference object itself. + */ + public ImageReference withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the sku property: The image sku. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The image sku. + * + * @param sku the sku value to set. + * @return the ImageReference object itself. + */ + public ImageReference withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageValidationErrorDetails.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageValidationErrorDetails.java new file mode 100644 index 000000000000..e803dce5aa95 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageValidationErrorDetails.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Image validation error details. */ +@Fluent +public final class ImageValidationErrorDetails { + /* + * An identifier for the error. + */ + @JsonProperty(value = "code") + private String code; + + /* + * A message describing the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: An identifier for the error. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: An identifier for the error. + * + * @param code the code value to set. + * @return the ImageValidationErrorDetails object itself. + */ + public ImageValidationErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: A message describing the error. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: A message describing the error. + * + * @param message the message value to set. + * @return the ImageValidationErrorDetails object itself. + */ + public ImageValidationErrorDetails withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageValidationStatus.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageValidationStatus.java new file mode 100644 index 000000000000..69ffdeb8907a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageValidationStatus.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ImageValidationStatus. */ +public final class ImageValidationStatus extends ExpandableStringEnum { + /** Static value Unknown for ImageValidationStatus. */ + public static final ImageValidationStatus UNKNOWN = fromString("Unknown"); + + /** Static value Pending for ImageValidationStatus. */ + public static final ImageValidationStatus PENDING = fromString("Pending"); + + /** Static value Succeeded for ImageValidationStatus. */ + public static final ImageValidationStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ImageValidationStatus. */ + public static final ImageValidationStatus FAILED = fromString("Failed"); + + /** Static value TimedOut for ImageValidationStatus. */ + public static final ImageValidationStatus TIMED_OUT = fromString("TimedOut"); + + /** + * Creates or finds a ImageValidationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageValidationStatus. + */ + @JsonCreator + public static ImageValidationStatus fromString(String name) { + return fromString(name, ImageValidationStatus.class); + } + + /** + * Gets known ImageValidationStatus values. + * + * @return known ImageValidationStatus values. + */ + public static Collection values() { + return values(ImageValidationStatus.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersion.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersion.java new file mode 100644 index 000000000000..8b44626c5ec8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersion.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ImageVersion. */ +public interface ImageVersion { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the namePropertiesName property: The semantic version string. + * + * @return the namePropertiesName value. + */ + String namePropertiesName(); + + /** + * Gets the publishedDate property: The datetime that the backing image version was published. + * + * @return the publishedDate value. + */ + OffsetDateTime publishedDate(); + + /** + * Gets the excludeFromLatest property: If the version should be excluded from being treated as the latest version. + * + * @return the excludeFromLatest value. + */ + Boolean excludeFromLatest(); + + /** + * Gets the osDiskImageSizeInGb property: The size of the OS disk image, in GB. + * + * @return the osDiskImageSizeInGb value. + */ + Integer osDiskImageSizeInGb(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner object. + * + * @return the inner object. + */ + ImageVersionInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersionListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersionListResult.java new file mode 100644 index 000000000000..c5564f0bf43e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersionListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.ImageVersionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the image version list operation. */ +@Immutable +public final class ImageVersionListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersions.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersions.java new file mode 100644 index 000000000000..8d58cef9bffa --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ImageVersions.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.devcenter.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 ImageVersions. */ +public interface ImageVersions { + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName); + + /** + * Lists versions for an image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 results of the image version list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByImage( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context); + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version. + */ + ImageVersion get( + String resourceGroupName, String devCenterName, String galleryName, String imageName, String versionName); + + /** + * Gets an image version. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @param versionName The version of the image. + * @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 an image version along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String devCenterName, + String galleryName, + String imageName, + String versionName, + Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Images.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Images.java new file mode 100644 index 000000000000..89acbcbe0cba --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Images.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 Images. */ +public interface Images { + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName); + + /** + * Lists images for a devcenter. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDevCenter(String resourceGroupName, String devCenterName, Integer top, Context context); + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByGallery(String resourceGroupName, String devCenterName, String galleryName); + + /** + * Lists images for a gallery. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the image list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByGallery( + String resourceGroupName, String devCenterName, String galleryName, Integer top, Context context); + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image. + */ + Image get(String resourceGroupName, String devCenterName, String galleryName, String imageName); + + /** + * Gets a gallery image. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param devCenterName The name of the devcenter. + * @param galleryName The name of the gallery. + * @param imageName The name of the image. + * @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 gallery image along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String devCenterName, String galleryName, String imageName, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/LicenseType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/LicenseType.java new file mode 100644 index 000000000000..ddb9255d03b5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/LicenseType.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LicenseType. */ +public final class LicenseType extends ExpandableStringEnum { + /** Static value Windows_Client for LicenseType. */ + public static final LicenseType WINDOWS_CLIENT = fromString("Windows_Client"); + + /** + * Creates or finds a LicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LicenseType. + */ + @JsonCreator + public static LicenseType fromString(String name) { + return fromString(name, LicenseType.class); + } + + /** + * Gets known LicenseType values. + * + * @return known LicenseType values. + */ + public static Collection values() { + return values(LicenseType.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ListUsagesResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ListUsagesResult.java new file mode 100644 index 000000000000..4fe0136e5742 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ListUsagesResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Core Usages. */ +@Immutable +public final class ListUsagesResult { + /* + * The array page of Usages. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to get the next page of Usage result. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The array page of Usages. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to get the next page of Usage result. + * + * @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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/LocalAdminStatus.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/LocalAdminStatus.java new file mode 100644 index 000000000000..efd76551e7b0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/LocalAdminStatus.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LocalAdminStatus. */ +public final class LocalAdminStatus extends ExpandableStringEnum { + /** Static value Disabled for LocalAdminStatus. */ + public static final LocalAdminStatus DISABLED = fromString("Disabled"); + + /** Static value Enabled for LocalAdminStatus. */ + public static final LocalAdminStatus ENABLED = fromString("Enabled"); + + /** + * Creates or finds a LocalAdminStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding LocalAdminStatus. + */ + @JsonCreator + public static LocalAdminStatus fromString(String name) { + return fromString(name, LocalAdminStatus.class); + } + + /** + * Gets known LocalAdminStatus values. + * + * @return known LocalAdminStatus values. + */ + public static Collection values() { + return values(LocalAdminStatus.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ManagedServiceIdentity.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..597856940ec3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ManagedServiceIdentity.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property + * will only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and + * UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + 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 ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ManagedServiceIdentityType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..76b995c2d469 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ManagedServiceIdentityType.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedServiceIdentityType. */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned, UserAssigned"); + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnection.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnection.java new file mode 100644 index 000000000000..0958cd2a6c55 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnection.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.NetworkConnectionInner; +import java.util.Map; + +/** An immutable client-side representation of NetworkConnection. */ +public interface NetworkConnection { + /** + * 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the healthCheckStatus property: Overall health status of the network connection. Health checks are run on + * creation, update, and periodically to validate the network connection. + * + * @return the healthCheckStatus value. + */ + HealthCheckStatus healthCheckStatus(); + + /** + * Gets the networkingResourceGroupName property: The name for resource group where NICs will be placed. + * + * @return the networkingResourceGroupName value. + */ + String networkingResourceGroupName(); + + /** + * Gets the domainJoinType property: AAD Join type. + * + * @return the domainJoinType value. + */ + DomainJoinType domainJoinType(); + + /** + * Gets the subnetId property: The subnet to attach Virtual Machines to. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets the domainName property: Active Directory domain name. + * + * @return the domainName value. + */ + String domainName(); + + /** + * Gets the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @return the organizationUnit value. + */ + String organizationUnit(); + + /** + * Gets the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @return the domainUsername value. + */ + String domainUsername(); + + /** + * Gets the domainPassword property: The password for the account used to join domain. + * + * @return the domainPassword value. + */ + String domainPassword(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.NetworkConnectionInner object. + * + * @return the inner object. + */ + NetworkConnectionInner innerModel(); + + /** The entirety of the NetworkConnection definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The NetworkConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the NetworkConnection definition. */ + interface Blank extends WithLocation { + } + /** The stage of the NetworkConnection 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 NetworkConnection definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the NetworkConnection 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.WithNetworkingResourceGroupName, + DefinitionStages.WithDomainJoinType, + DefinitionStages.WithSubnetId, + DefinitionStages.WithDomainName, + DefinitionStages.WithOrganizationUnit, + DefinitionStages.WithDomainUsername, + DefinitionStages.WithDomainPassword { + /** + * Executes the create request. + * + * @return the created resource. + */ + NetworkConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NetworkConnection create(Context context); + } + /** The stage of the NetworkConnection 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 NetworkConnection definition allowing to specify networkingResourceGroupName. */ + interface WithNetworkingResourceGroupName { + /** + * Specifies the networkingResourceGroupName property: The name for resource group where NICs will be + * placed.. + * + * @param networkingResourceGroupName The name for resource group where NICs will be placed. + * @return the next definition stage. + */ + WithCreate withNetworkingResourceGroupName(String networkingResourceGroupName); + } + /** The stage of the NetworkConnection definition allowing to specify domainJoinType. */ + interface WithDomainJoinType { + /** + * Specifies the domainJoinType property: AAD Join type.. + * + * @param domainJoinType AAD Join type. + * @return the next definition stage. + */ + WithCreate withDomainJoinType(DomainJoinType domainJoinType); + } + /** The stage of the NetworkConnection definition allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: The subnet to attach Virtual Machines to. + * + * @param subnetId The subnet to attach Virtual Machines to. + * @return the next definition stage. + */ + WithCreate withSubnetId(String subnetId); + } + /** The stage of the NetworkConnection definition allowing to specify domainName. */ + interface WithDomainName { + /** + * Specifies the domainName property: Active Directory domain name. + * + * @param domainName Active Directory domain name. + * @return the next definition stage. + */ + WithCreate withDomainName(String domainName); + } + /** The stage of the NetworkConnection definition allowing to specify organizationUnit. */ + interface WithOrganizationUnit { + /** + * Specifies the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @param organizationUnit Active Directory domain Organization Unit (OU). + * @return the next definition stage. + */ + WithCreate withOrganizationUnit(String organizationUnit); + } + /** The stage of the NetworkConnection definition allowing to specify domainUsername. */ + interface WithDomainUsername { + /** + * Specifies the domainUsername property: The username of an Active Directory account (user or service + * account) that has permissions to create computer objects in Active Directory. Required format: + * admin@contoso.com.. + * + * @param domainUsername The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * @return the next definition stage. + */ + WithCreate withDomainUsername(String domainUsername); + } + /** The stage of the NetworkConnection definition allowing to specify domainPassword. */ + interface WithDomainPassword { + /** + * Specifies the domainPassword property: The password for the account used to join domain. + * + * @param domainPassword The password for the account used to join domain. + * @return the next definition stage. + */ + WithCreate withDomainPassword(String domainPassword); + } + } + /** + * Begins update for the NetworkConnection resource. + * + * @return the stage of resource update. + */ + NetworkConnection.Update update(); + + /** The template for NetworkConnection update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSubnetId, + UpdateStages.WithDomainName, + UpdateStages.WithOrganizationUnit, + UpdateStages.WithDomainUsername, + UpdateStages.WithDomainPassword { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NetworkConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NetworkConnection apply(Context context); + } + /** The NetworkConnection update stages. */ + interface UpdateStages { + /** The stage of the NetworkConnection 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 NetworkConnection update allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: The subnet to attach Virtual Machines to. + * + * @param subnetId The subnet to attach Virtual Machines to. + * @return the next definition stage. + */ + Update withSubnetId(String subnetId); + } + /** The stage of the NetworkConnection update allowing to specify domainName. */ + interface WithDomainName { + /** + * Specifies the domainName property: Active Directory domain name. + * + * @param domainName Active Directory domain name. + * @return the next definition stage. + */ + Update withDomainName(String domainName); + } + /** The stage of the NetworkConnection update allowing to specify organizationUnit. */ + interface WithOrganizationUnit { + /** + * Specifies the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @param organizationUnit Active Directory domain Organization Unit (OU). + * @return the next definition stage. + */ + Update withOrganizationUnit(String organizationUnit); + } + /** The stage of the NetworkConnection update allowing to specify domainUsername. */ + interface WithDomainUsername { + /** + * Specifies the domainUsername property: The username of an Active Directory account (user or service + * account) that has permissions to create computer objects in Active Directory. Required format: + * admin@contoso.com.. + * + * @param domainUsername The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * @return the next definition stage. + */ + Update withDomainUsername(String domainUsername); + } + /** The stage of the NetworkConnection update allowing to specify domainPassword. */ + interface WithDomainPassword { + /** + * Specifies the domainPassword property: The password for the account used to join domain. + * + * @param domainPassword The password for the account used to join domain. + * @return the next definition stage. + */ + Update withDomainPassword(String domainPassword); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NetworkConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NetworkConnection refresh(Context context); + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @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 runHealthChecks(); + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response runHealthChecksWithResponse(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnectionListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnectionListResult.java new file mode 100644 index 000000000000..42b078d45f86 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnectionListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.NetworkConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the network connection list operation. */ +@Immutable +public final class NetworkConnectionListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnectionUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnectionUpdate.java new file mode 100644 index 000000000000..8818acd8fbc4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnectionUpdate.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.NetworkConnectionUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The network connection properties for partial update. Properties not provided in the update request will not be + * changed. + */ +@Fluent +public final class NetworkConnectionUpdate extends TrackedResourceUpdate { + /* + * Properties of a network connection resource to be updated. + */ + @JsonProperty(value = "properties") + private NetworkConnectionUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Properties of a network connection resource to be updated. + * + * @return the innerProperties value. + */ + private NetworkConnectionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public NetworkConnectionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkConnectionUpdate withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the subnetId property: The subnet to attach Virtual Machines to. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Set the subnetId property: The subnet to attach Virtual Machines to. + * + * @param subnetId the subnetId value to set. + * @return the NetworkConnectionUpdate object itself. + */ + public NetworkConnectionUpdate withSubnetId(String subnetId) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkConnectionUpdateProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the domainName property: Active Directory domain name. + * + * @return the domainName value. + */ + public String domainName() { + return this.innerProperties() == null ? null : this.innerProperties().domainName(); + } + + /** + * Set the domainName property: Active Directory domain name. + * + * @param domainName the domainName value to set. + * @return the NetworkConnectionUpdate object itself. + */ + public NetworkConnectionUpdate withDomainName(String domainName) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkConnectionUpdateProperties(); + } + this.innerProperties().withDomainName(domainName); + return this; + } + + /** + * Get the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @return the organizationUnit value. + */ + public String organizationUnit() { + return this.innerProperties() == null ? null : this.innerProperties().organizationUnit(); + } + + /** + * Set the organizationUnit property: Active Directory domain Organization Unit (OU). + * + * @param organizationUnit the organizationUnit value to set. + * @return the NetworkConnectionUpdate object itself. + */ + public NetworkConnectionUpdate withOrganizationUnit(String organizationUnit) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkConnectionUpdateProperties(); + } + this.innerProperties().withOrganizationUnit(organizationUnit); + return this; + } + + /** + * Get the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @return the domainUsername value. + */ + public String domainUsername() { + return this.innerProperties() == null ? null : this.innerProperties().domainUsername(); + } + + /** + * Set the domainUsername property: The username of an Active Directory account (user or service account) that has + * permissions to create computer objects in Active Directory. Required format: admin@contoso.com. + * + * @param domainUsername the domainUsername value to set. + * @return the NetworkConnectionUpdate object itself. + */ + public NetworkConnectionUpdate withDomainUsername(String domainUsername) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkConnectionUpdateProperties(); + } + this.innerProperties().withDomainUsername(domainUsername); + return this; + } + + /** + * Get the domainPassword property: The password for the account used to join domain. + * + * @return the domainPassword value. + */ + public String domainPassword() { + return this.innerProperties() == null ? null : this.innerProperties().domainPassword(); + } + + /** + * Set the domainPassword property: The password for the account used to join domain. + * + * @param domainPassword the domainPassword value to set. + * @return the NetworkConnectionUpdate object itself. + */ + public NetworkConnectionUpdate withDomainPassword(String domainPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkConnectionUpdateProperties(); + } + this.innerProperties().withDomainPassword(domainPassword); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnections.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnections.java new file mode 100644 index 000000000000..059c2191caa4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/NetworkConnections.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 NetworkConnections. */ +public interface NetworkConnections { + /** + * Lists network connections in 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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists network connections in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Integer top, Context context); + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists network connections in a resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network connection list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource. + */ + NetworkConnection getByResourceGroup(String resourceGroupName, String networkConnectionName); + + /** + * Gets a network connection resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 network connection resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String networkConnectionName, Context context); + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 networkConnectionName); + + /** + * Deletes a Network Connections resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 networkConnectionName, Context context); + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 result of the network health check list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHealthDetails(String resourceGroupName, String networkConnectionName); + + /** + * Lists health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the network health check list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHealthDetails( + String resourceGroupName, String networkConnectionName, Integer top, Context context); + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details. + */ + HealthCheckStatusDetails getHealthDetails(String resourceGroupName, String networkConnectionName); + + /** + * Gets health check status details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 health check status details along with {@link Response}. + */ + Response getHealthDetailsWithResponse( + String resourceGroupName, String networkConnectionName, Context context); + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @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 runHealthChecks(String resourceGroupName, String networkConnectionName); + + /** + * Triggers a new health check run. The execution and health check result can be tracked via the network Connection + * health check details. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param networkConnectionName Name of the Network Connection that can be applied to a Pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response runHealthChecksWithResponse(String resourceGroupName, String networkConnectionName, Context context); + + /** + * Gets a network connection resource. + * + * @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 a network connection resource along with {@link Response}. + */ + NetworkConnection getById(String id); + + /** + * Gets a network connection resource. + * + * @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 a network connection resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Network Connections resource. + * + * @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 a Network Connections resource. + * + * @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 NetworkConnection resource. + * + * @param name resource name. + * @return the first stage of the new NetworkConnection definition. + */ + NetworkConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Operation.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Operation.java new file mode 100644 index 000000000000..2648f1bd8d7c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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.devcenter.models; + +import com.azure.resourcemanager.devcenter.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.devcenter.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationDisplay.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationDisplay.java new file mode 100644 index 000000000000..d872c74e6fc7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationDisplay.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationListResult.java new file mode 100644 index 000000000000..a9cc9d0e5d94 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationListResult.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.OperationInner; +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 { + /* + * 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatus.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatus.java new file mode 100644 index 000000000000..5170acc681e3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatus.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.devcenter.models; + +import com.azure.resourcemanager.devcenter.fluent.models.OperationStatusInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of OperationStatus. */ +public interface OperationStatus { + /** + * Gets the id property: Fully qualified ID for the operation status. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The operation id name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: Provisioning state of the resource. + * + * @return the status value. + */ + String status(); + + /** + * Gets the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + Float percentComplete(); + + /** + * Gets the properties property: Custom operation properties, populated only for a successful operation. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the error property: Operation Error message. + * + * @return the error value. + */ + OperationStatusError error(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.OperationStatusInner object. + * + * @return the inner object. + */ + OperationStatusInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatusError.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatusError.java new file mode 100644 index 000000000000..5f675a6b1bb4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatusError.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation Error message. */ +@Immutable +public final class OperationStatusError { + /* + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatuses.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatuses.java new file mode 100644 index 000000000000..cb5009a75d36 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/OperationStatuses.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.devcenter.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationStatuses. */ +public interface OperationStatuses { + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + OperationStatus get(String location, String operationId); + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation along with {@link Response}. + */ + Response getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Operations.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Operations.java new file mode 100644 index 000000000000..48ebcc29834a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available resource provider 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 as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Origin.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Origin.java new file mode 100644 index 000000000000..af7ec93c151a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Origin.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Pool.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Pool.java new file mode 100644 index 000000000000..c3afade07502 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Pool.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.PoolInner; +import java.util.Map; + +/** An immutable client-side representation of Pool. */ +public interface Pool { + /** + * 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @return the devBoxDefinitionName value. + */ + String devBoxDefinitionName(); + + /** + * Gets the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @return the networkConnectionName value. + */ + String networkConnectionName(); + + /** + * Gets the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @return the licenseType value. + */ + LicenseType licenseType(); + + /** + * Gets the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @return the localAdministrator value. + */ + LocalAdminStatus localAdministrator(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.PoolInner object. + * + * @return the inner object. + */ + PoolInner innerModel(); + + /** The entirety of the Pool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Pool definition stages. */ + interface DefinitionStages { + /** The first stage of the Pool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Pool 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Pool definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, projectName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @return the next definition stage. + */ + WithCreate withExistingProject(String resourceGroupName, String projectName); + } + /** + * The stage of the Pool 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.WithDevBoxDefinitionName, + DefinitionStages.WithNetworkConnectionName, + DefinitionStages.WithLicenseType, + DefinitionStages.WithLocalAdministrator { + /** + * Executes the create request. + * + * @return the created resource. + */ + Pool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Pool create(Context context); + } + /** The stage of the Pool 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 Pool definition allowing to specify devBoxDefinitionName. */ + interface WithDevBoxDefinitionName { + /** + * Specifies the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @param devBoxDefinitionName Name of a Dev Box definition in parent Project of this Pool. + * @return the next definition stage. + */ + WithCreate withDevBoxDefinitionName(String devBoxDefinitionName); + } + /** The stage of the Pool definition allowing to specify networkConnectionName. */ + interface WithNetworkConnectionName { + /** + * Specifies the networkConnectionName property: Name of a Network Connection in parent Project of this + * Pool. + * + * @param networkConnectionName Name of a Network Connection in parent Project of this Pool. + * @return the next definition stage. + */ + WithCreate withNetworkConnectionName(String networkConnectionName); + } + /** The stage of the Pool definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: Specifies the license type indicating the caller has already acquired + * licenses for the Dev Boxes that will be created.. + * + * @param licenseType Specifies the license type indicating the caller has already acquired licenses for the + * Dev Boxes that will be created. + * @return the next definition stage. + */ + WithCreate withLicenseType(LicenseType licenseType); + } + /** The stage of the Pool definition allowing to specify localAdministrator. */ + interface WithLocalAdministrator { + /** + * Specifies the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added + * as local administrators on the Dev Box.. + * + * @param localAdministrator Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * @return the next definition stage. + */ + WithCreate withLocalAdministrator(LocalAdminStatus localAdministrator); + } + } + /** + * Begins update for the Pool resource. + * + * @return the stage of resource update. + */ + Pool.Update update(); + + /** The template for Pool update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDevBoxDefinitionName, + UpdateStages.WithNetworkConnectionName, + UpdateStages.WithLicenseType, + UpdateStages.WithLocalAdministrator { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Pool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Pool apply(Context context); + } + /** The Pool update stages. */ + interface UpdateStages { + /** The stage of the Pool 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 Pool update allowing to specify devBoxDefinitionName. */ + interface WithDevBoxDefinitionName { + /** + * Specifies the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @param devBoxDefinitionName Name of a Dev Box definition in parent Project of this Pool. + * @return the next definition stage. + */ + Update withDevBoxDefinitionName(String devBoxDefinitionName); + } + /** The stage of the Pool update allowing to specify networkConnectionName. */ + interface WithNetworkConnectionName { + /** + * Specifies the networkConnectionName property: Name of a Network Connection in parent Project of this + * Pool. + * + * @param networkConnectionName Name of a Network Connection in parent Project of this Pool. + * @return the next definition stage. + */ + Update withNetworkConnectionName(String networkConnectionName); + } + /** The stage of the Pool update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: Specifies the license type indicating the caller has already acquired + * licenses for the Dev Boxes that will be created.. + * + * @param licenseType Specifies the license type indicating the caller has already acquired licenses for the + * Dev Boxes that will be created. + * @return the next definition stage. + */ + Update withLicenseType(LicenseType licenseType); + } + /** The stage of the Pool update allowing to specify localAdministrator. */ + interface WithLocalAdministrator { + /** + * Specifies the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added + * as local administrators on the Dev Box.. + * + * @param localAdministrator Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * @return the next definition stage. + */ + Update withLocalAdministrator(LocalAdminStatus localAdministrator); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Pool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Pool refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/PoolListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/PoolListResult.java new file mode 100644 index 000000000000..25aa6e3d7a78 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/PoolListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.PoolInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the machine pool list operation. */ +@Immutable +public final class PoolListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/PoolUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/PoolUpdate.java new file mode 100644 index 000000000000..7b46bdd42816 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/PoolUpdate.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.PoolUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The pool properties for partial update. Properties not provided in the update request will not be changed. */ +@Fluent +public final class PoolUpdate extends TrackedResourceUpdate { + /* + * Properties of a pool to be updated. + */ + @JsonProperty(value = "properties") + private PoolUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Properties of a pool to be updated. + * + * @return the innerProperties value. + */ + private PoolUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public PoolUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public PoolUpdate withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @return the devBoxDefinitionName value. + */ + public String devBoxDefinitionName() { + return this.innerProperties() == null ? null : this.innerProperties().devBoxDefinitionName(); + } + + /** + * Set the devBoxDefinitionName property: Name of a Dev Box definition in parent Project of this Pool. + * + * @param devBoxDefinitionName the devBoxDefinitionName value to set. + * @return the PoolUpdate object itself. + */ + public PoolUpdate withDevBoxDefinitionName(String devBoxDefinitionName) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolUpdateProperties(); + } + this.innerProperties().withDevBoxDefinitionName(devBoxDefinitionName); + return this; + } + + /** + * Get the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @return the networkConnectionName value. + */ + public String networkConnectionName() { + return this.innerProperties() == null ? null : this.innerProperties().networkConnectionName(); + } + + /** + * Set the networkConnectionName property: Name of a Network Connection in parent Project of this Pool. + * + * @param networkConnectionName the networkConnectionName value to set. + * @return the PoolUpdate object itself. + */ + public PoolUpdate withNetworkConnectionName(String networkConnectionName) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolUpdateProperties(); + } + this.innerProperties().withNetworkConnectionName(networkConnectionName); + return this; + } + + /** + * Get the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @return the licenseType value. + */ + public LicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies the license type indicating the caller has already acquired licenses for + * the Dev Boxes that will be created. + * + * @param licenseType the licenseType value to set. + * @return the PoolUpdate object itself. + */ + public PoolUpdate withLicenseType(LicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolUpdateProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @return the localAdministrator value. + */ + public LocalAdminStatus localAdministrator() { + return this.innerProperties() == null ? null : this.innerProperties().localAdministrator(); + } + + /** + * Set the localAdministrator property: Indicates whether owners of Dev Boxes in this pool are added as local + * administrators on the Dev Box. + * + * @param localAdministrator the localAdministrator value to set. + * @return the PoolUpdate object itself. + */ + public PoolUpdate withLocalAdministrator(LocalAdminStatus localAdministrator) { + if (this.innerProperties() == null) { + this.innerProperties = new PoolUpdateProperties(); + } + this.innerProperties().withLocalAdministrator(localAdministrator); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Pools.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Pools.java new file mode 100644 index 000000000000..10b7bcce3a2b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Pools.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 Pools. */ +public interface Pools { + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 results of the machine pool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProject(String resourceGroupName, String projectName); + + /** + * Lists pools for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the machine pool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProject(String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool. + */ + Pool get(String resourceGroupName, String projectName, String poolName); + + /** + * Gets a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 machine pool along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String projectName, String poolName, Context context); + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 projectName, String poolName); + + /** + * Deletes a machine pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 projectName, String poolName, Context context); + + /** + * Gets a machine pool. + * + * @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 a machine pool along with {@link Response}. + */ + Pool getById(String id); + + /** + * Gets a machine pool. + * + * @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 a machine pool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a machine pool. + * + * @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 a machine pool. + * + * @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 Pool resource. + * + * @param name resource name. + * @return the first stage of the new Pool definition. + */ + Pool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Project.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Project.java new file mode 100644 index 000000000000..2bdb23f32871 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Project.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectInner; +import java.util.Map; + +/** An immutable client-side representation of Project. */ +public interface Project { + /** + * 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the devCenterId property: Resource Id of an associated DevCenter. + * + * @return the devCenterId value. + */ + String devCenterId(); + + /** + * Gets the description property: Description of the project. + * + * @return the description value. + */ + String description(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.ProjectInner object. + * + * @return the inner object. + */ + ProjectInner innerModel(); + + /** The entirety of the Project definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Project definition stages. */ + interface DefinitionStages { + /** The first stage of the Project definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Project 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 Project definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Project 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.WithDevCenterId, DefinitionStages.WithDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + Project create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Project create(Context context); + } + /** The stage of the Project 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 Project definition allowing to specify devCenterId. */ + interface WithDevCenterId { + /** + * Specifies the devCenterId property: Resource Id of an associated DevCenter. + * + * @param devCenterId Resource Id of an associated DevCenter. + * @return the next definition stage. + */ + WithCreate withDevCenterId(String devCenterId); + } + /** The stage of the Project definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the project.. + * + * @param description Description of the project. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + /** + * Begins update for the Project resource. + * + * @return the stage of resource update. + */ + Project.Update update(); + + /** The template for Project update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithDevCenterId, UpdateStages.WithDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Project apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Project apply(Context context); + } + /** The Project update stages. */ + interface UpdateStages { + /** The stage of the Project 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 Project update allowing to specify devCenterId. */ + interface WithDevCenterId { + /** + * Specifies the devCenterId property: Resource Id of an associated DevCenter. + * + * @param devCenterId Resource Id of an associated DevCenter. + * @return the next definition stage. + */ + Update withDevCenterId(String devCenterId); + } + /** The stage of the Project update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the project.. + * + * @param description Description of the project. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Project refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Project refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentType.java new file mode 100644 index 000000000000..0a79ae475b94 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentType.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.devcenter.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner; +import java.util.Map; + +/** An immutable client-side representation of ProjectEnvironmentType. */ +public interface ProjectEnvironmentType { + /** + * 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 tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Managed identity properties. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the location property: The geo-location for the environment type. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @return the deploymentTargetId value. + */ + String deploymentTargetId(); + + /** + * Gets the status property: Defines whether this Environment Type can be used in this Project. + * + * @return the status value. + */ + EnableStatus status(); + + /** + * Gets the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @return the creatorRoleAssignment value. + */ + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment(); + + /** + * Gets the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @return the userRoleAssignments value. + */ + Map userRoleAssignments(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner object. + * + * @return the inner object. + */ + ProjectEnvironmentTypeInner innerModel(); + + /** The entirety of the ProjectEnvironmentType definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ProjectEnvironmentType definition stages. */ + interface DefinitionStages { + /** The first stage of the ProjectEnvironmentType definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ProjectEnvironmentType definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, projectName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @return the next definition stage. + */ + WithCreate withExistingProject(String resourceGroupName, String projectName); + } + /** + * The stage of the ProjectEnvironmentType 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.WithLocation, + DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithDeploymentTargetId, + DefinitionStages.WithStatus, + DefinitionStages.WithCreatorRoleAssignment, + DefinitionStages.WithUserRoleAssignments { + /** + * Executes the create request. + * + * @return the created resource. + */ + ProjectEnvironmentType create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ProjectEnvironmentType create(Context context); + } + /** The stage of the ProjectEnvironmentType definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location for the environment type. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location for the environment type. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the ProjectEnvironmentType 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 ProjectEnvironmentType definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity properties. + * + * @param identity Managed identity properties. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the ProjectEnvironmentType definition allowing to specify deploymentTargetId. */ + interface WithDeploymentTargetId { + /** + * Specifies the deploymentTargetId property: Id of a subscription that the environment type will be mapped + * to. The environment's resources will be deployed into this subscription.. + * + * @param deploymentTargetId Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * @return the next definition stage. + */ + WithCreate withDeploymentTargetId(String deploymentTargetId); + } + /** The stage of the ProjectEnvironmentType definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: Defines whether this Environment Type can be used in this Project.. + * + * @param status Defines whether this Environment Type can be used in this Project. + * @return the next definition stage. + */ + WithCreate withStatus(EnableStatus status); + } + /** The stage of the ProjectEnvironmentType definition allowing to specify creatorRoleAssignment. */ + interface WithCreatorRoleAssignment { + /** + * Specifies the creatorRoleAssignment property: The role definition assigned to the environment creator on + * backing resources.. + * + * @param creatorRoleAssignment The role definition assigned to the environment creator on backing + * resources. + * @return the next definition stage. + */ + WithCreate withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment); + } + /** The stage of the ProjectEnvironmentType definition allowing to specify userRoleAssignments. */ + interface WithUserRoleAssignments { + /** + * Specifies the userRoleAssignments property: Role Assignments created on environment backing resources. + * This is a mapping from a user object ID to an object of role definition IDs.. + * + * @param userRoleAssignments Role Assignments created on environment backing resources. This is a mapping + * from a user object ID to an object of role definition IDs. + * @return the next definition stage. + */ + WithCreate withUserRoleAssignments(Map userRoleAssignments); + } + } + /** + * Begins update for the ProjectEnvironmentType resource. + * + * @return the stage of resource update. + */ + ProjectEnvironmentType.Update update(); + + /** The template for ProjectEnvironmentType update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithDeploymentTargetId, + UpdateStages.WithStatus, + UpdateStages.WithCreatorRoleAssignment, + UpdateStages.WithUserRoleAssignments { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ProjectEnvironmentType apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ProjectEnvironmentType apply(Context context); + } + /** The ProjectEnvironmentType update stages. */ + interface UpdateStages { + /** The stage of the ProjectEnvironmentType 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 ProjectEnvironmentType update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity properties. + * + * @param identity Managed identity properties. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the ProjectEnvironmentType update allowing to specify deploymentTargetId. */ + interface WithDeploymentTargetId { + /** + * Specifies the deploymentTargetId property: Id of a subscription that the environment type will be mapped + * to. The environment's resources will be deployed into this subscription.. + * + * @param deploymentTargetId Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * @return the next definition stage. + */ + Update withDeploymentTargetId(String deploymentTargetId); + } + /** The stage of the ProjectEnvironmentType update allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: Defines whether this Environment Type can be used in this Project.. + * + * @param status Defines whether this Environment Type can be used in this Project. + * @return the next definition stage. + */ + Update withStatus(EnableStatus status); + } + /** The stage of the ProjectEnvironmentType update allowing to specify creatorRoleAssignment. */ + interface WithCreatorRoleAssignment { + /** + * Specifies the creatorRoleAssignment property: The role definition assigned to the environment creator on + * backing resources.. + * + * @param creatorRoleAssignment The role definition assigned to the environment creator on backing + * resources. + * @return the next definition stage. + */ + Update withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment); + } + /** The stage of the ProjectEnvironmentType update allowing to specify userRoleAssignments. */ + interface WithUserRoleAssignments { + /** + * Specifies the userRoleAssignments property: Role Assignments created on environment backing resources. + * This is a mapping from a user object ID to an object of role definition IDs.. + * + * @param userRoleAssignments Role Assignments created on environment backing resources. This is a mapping + * from a user object ID to an object of role definition IDs. + * @return the next definition stage. + */ + Update withUserRoleAssignments(Map userRoleAssignments); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ProjectEnvironmentType refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ProjectEnvironmentType refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeListResult.java new file mode 100644 index 000000000000..b1f7521d7a9c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the project environment type list operation. */ +@Immutable +public final class ProjectEnvironmentTypeListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeUpdate.java new file mode 100644 index 000000000000..f28a300fcf57 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeUpdate.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The project environment type for partial update. Properties not provided in the update request will not be changed. + */ +@Fluent +public final class ProjectEnvironmentTypeUpdate { + /* + * Properties to configure an environment type. + */ + @JsonProperty(value = "properties") + private ProjectEnvironmentTypeUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Managed identity properties + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /** + * Get the innerProperties property: Properties to configure an environment type. + * + * @return the innerProperties value. + */ + private ProjectEnvironmentTypeUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ProjectEnvironmentTypeUpdate object itself. + */ + public ProjectEnvironmentTypeUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: Managed identity properties. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties. + * + * @param identity the identity value to set. + * @return the ProjectEnvironmentTypeUpdate object itself. + */ + public ProjectEnvironmentTypeUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @return the deploymentTargetId value. + */ + public String deploymentTargetId() { + return this.innerProperties() == null ? null : this.innerProperties().deploymentTargetId(); + } + + /** + * Set the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The + * environment's resources will be deployed into this subscription. + * + * @param deploymentTargetId the deploymentTargetId value to set. + * @return the ProjectEnvironmentTypeUpdate object itself. + */ + public ProjectEnvironmentTypeUpdate withDeploymentTargetId(String deploymentTargetId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeUpdateProperties(); + } + this.innerProperties().withDeploymentTargetId(deploymentTargetId); + return this; + } + + /** + * Get the status property: Defines whether this Environment Type can be used in this Project. + * + * @return the status value. + */ + public EnableStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Defines whether this Environment Type can be used in this Project. + * + * @param status the status value to set. + * @return the ProjectEnvironmentTypeUpdate object itself. + */ + public ProjectEnvironmentTypeUpdate withStatus(EnableStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeUpdateProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @return the creatorRoleAssignment value. + */ + public ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment() { + return this.innerProperties() == null ? null : this.innerProperties().creatorRoleAssignment(); + } + + /** + * Set the creatorRoleAssignment property: The role definition assigned to the environment creator on backing + * resources. + * + * @param creatorRoleAssignment the creatorRoleAssignment value to set. + * @return the ProjectEnvironmentTypeUpdate object itself. + */ + public ProjectEnvironmentTypeUpdate withCreatorRoleAssignment( + ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeUpdateProperties(); + } + this.innerProperties().withCreatorRoleAssignment(creatorRoleAssignment); + return this; + } + + /** + * Get the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @return the userRoleAssignments value. + */ + public Map userRoleAssignments() { + return this.innerProperties() == null ? null : this.innerProperties().userRoleAssignments(); + } + + /** + * Set the userRoleAssignments property: Role Assignments created on environment backing resources. This is a + * mapping from a user object ID to an object of role definition IDs. + * + * @param userRoleAssignments the userRoleAssignments value to set. + * @return the ProjectEnvironmentTypeUpdate object itself. + */ + public ProjectEnvironmentTypeUpdate withUserRoleAssignments( + Map userRoleAssignments) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectEnvironmentTypeUpdateProperties(); + } + this.innerProperties().withUserRoleAssignments(userRoleAssignments); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment.java new file mode 100644 index 000000000000..7d40877f3d14 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The role definition assigned to the environment creator on backing resources. */ +@Fluent +public final class ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment { + /* + * A map of roles to assign to the environment creator. + */ + @JsonProperty(value = "roles") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map roles; + + /** + * Get the roles property: A map of roles to assign to the environment creator. + * + * @return the roles value. + */ + public Map roles() { + return this.roles; + } + + /** + * Set the roles property: A map of roles to assign to the environment creator. + * + * @param roles the roles value to set. + * @return the ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment object itself. + */ + public ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment withRoles(Map roles) { + this.roles = roles; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roles() != null) { + roles() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypes.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypes.java new file mode 100644 index 000000000000..f44894c80034 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectEnvironmentTypes.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 ProjectEnvironmentTypes. */ +public interface ProjectEnvironmentTypes { + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 result of the project environment type list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String projectName); + + /** + * Lists environment types for a project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the project environment type list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String projectName, Integer top, Context context); + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type. + */ + ProjectEnvironmentType get(String resourceGroupName, String projectName, String environmentTypeName); + + /** + * Gets a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 project environment type along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context); + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @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 projectName, String environmentTypeName); + + /** + * Deletes a project environment type. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param environmentTypeName The name of the environment type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String projectName, String environmentTypeName, Context context); + + /** + * Gets a project environment type. + * + * @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 a project environment type along with {@link Response}. + */ + ProjectEnvironmentType getById(String id); + + /** + * Gets a project environment type. + * + * @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 a project environment type along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a project environment type. + * + * @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 a project environment type. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ProjectEnvironmentType resource. + * + * @param name resource name. + * @return the first stage of the new ProjectEnvironmentType definition. + */ + ProjectEnvironmentType.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectListResult.java new file mode 100644 index 000000000000..bb33dff1b362 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the project list operation. */ +@Immutable +public final class ProjectListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectUpdate.java new file mode 100644 index 000000000000..5f9bf54870d6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ProjectUpdate.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.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.ProjectUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The project properties for partial update. Properties not provided in the update request will not be changed. */ +@Fluent +public final class ProjectUpdate extends TrackedResourceUpdate { + /* + * Properties of a project to be updated. + */ + @JsonProperty(value = "properties") + private ProjectUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Properties of a project to be updated. + * + * @return the innerProperties value. + */ + private ProjectUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ProjectUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProjectUpdate withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the devCenterId property: Resource Id of an associated DevCenter. + * + * @return the devCenterId value. + */ + public String devCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().devCenterId(); + } + + /** + * Set the devCenterId property: Resource Id of an associated DevCenter. + * + * @param devCenterId the devCenterId value to set. + * @return the ProjectUpdate object itself. + */ + public ProjectUpdate withDevCenterId(String devCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectUpdateProperties(); + } + this.innerProperties().withDevCenterId(devCenterId); + return this; + } + + /** + * Get the description property: Description of the project. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the project. + * + * @param description the description value to set. + * @return the ProjectUpdate object itself. + */ + public ProjectUpdate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProjectUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Projects.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Projects.java new file mode 100644 index 000000000000..53d8d0c8a7b1 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Projects.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.devcenter.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 Projects. */ +public interface Projects { + /** + * Lists all projects in 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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all projects in the subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Integer top, Context context); + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all projects in the resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the project list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project. + */ + Project getByResourceGroup(String resourceGroupName, String projectName); + + /** + * Gets a specific project. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 specific project along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String projectName, Context context); + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 projectName); + + /** + * Deletes a project resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @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 projectName, Context context); + + /** + * Gets a specific project. + * + * @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 a specific project along with {@link Response}. + */ + Project getById(String id); + + /** + * Gets a specific project. + * + * @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 a specific project along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a project resource. + * + * @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 a project resource. + * + * @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 Project resource. + * + * @param name resource name. + * @return the first stage of the new Project definition. + */ + Project.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/RecommendedMachineConfiguration.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/RecommendedMachineConfiguration.java new file mode 100644 index 000000000000..e4f22a33bb05 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/RecommendedMachineConfiguration.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for a recommended machine configuration. */ +@Immutable +public final class RecommendedMachineConfiguration { + /* + * Recommended memory range. + */ + @JsonProperty(value = "memory", access = JsonProperty.Access.WRITE_ONLY) + private ResourceRange memory; + + /* + * Recommended vCPU range. + */ + @JsonProperty(value = "vCPUs", access = JsonProperty.Access.WRITE_ONLY) + private ResourceRange vCPUs; + + /** + * Get the memory property: Recommended memory range. + * + * @return the memory value. + */ + public ResourceRange memory() { + return this.memory; + } + + /** + * Get the vCPUs property: Recommended vCPU range. + * + * @return the vCPUs value. + */ + public ResourceRange vCPUs() { + return this.vCPUs; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (memory() != null) { + memory().validate(); + } + if (vCPUs() != null) { + vCPUs().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ResourceRange.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ResourceRange.java new file mode 100644 index 000000000000..9c47686dbde3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ResourceRange.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for a range of values. */ +@Immutable +public final class ResourceRange { + /* + * Minimum value. + */ + @JsonProperty(value = "min", access = JsonProperty.Access.WRITE_ONLY) + private Integer min; + + /* + * Maximum value. + */ + @JsonProperty(value = "max", access = JsonProperty.Access.WRITE_ONLY) + private Integer max; + + /** + * Get the min property: Minimum value. + * + * @return the min value. + */ + public Integer min() { + return this.min; + } + + /** + * Get the max property: Maximum value. + * + * @return the max value. + */ + public Integer max() { + return this.max; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Schedule.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Schedule.java new file mode 100644 index 000000000000..b7417373061f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Schedule.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.fluent.models.ScheduleInner; + +/** An immutable client-side representation of Schedule. */ +public interface Schedule { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the typePropertiesType property: Supported type this scheduled task represents. + * + * @return the typePropertiesType value. + */ + ScheduledType typePropertiesType(); + + /** + * Gets the frequency property: The frequency of this scheduled task. + * + * @return the frequency value. + */ + ScheduledFrequency frequency(); + + /** + * Gets the time property: The target time to trigger the action. The format is HH:MM. + * + * @return the time value. + */ + String time(); + + /** + * Gets the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @return the timeZone value. + */ + String timeZone(); + + /** + * Gets the state property: Indicates whether or not this scheduled task is enabled. + * + * @return the state value. + */ + EnableStatus state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.ScheduleInner object. + * + * @return the inner object. + */ + ScheduleInner innerModel(); + + /** The entirety of the Schedule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Schedule definition stages. */ + interface DefinitionStages { + /** The first stage of the Schedule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Schedule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, projectName, poolName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @return the next definition stage. + */ + WithCreate withExistingPool(String resourceGroupName, String projectName, String poolName); + } + /** + * The stage of the Schedule 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.WithTypePropertiesType, + DefinitionStages.WithFrequency, + DefinitionStages.WithTime, + DefinitionStages.WithTimeZone, + DefinitionStages.WithState, + DefinitionStages.WithTop { + /** + * Executes the create request. + * + * @return the created resource. + */ + Schedule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Schedule create(Context context); + } + /** The stage of the Schedule definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Supported type this scheduled task represents.. + * + * @param typePropertiesType Supported type this scheduled task represents. + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(ScheduledType typePropertiesType); + } + /** The stage of the Schedule definition allowing to specify frequency. */ + interface WithFrequency { + /** + * Specifies the frequency property: The frequency of this scheduled task.. + * + * @param frequency The frequency of this scheduled task. + * @return the next definition stage. + */ + WithCreate withFrequency(ScheduledFrequency frequency); + } + /** The stage of the Schedule definition allowing to specify time. */ + interface WithTime { + /** + * Specifies the time property: The target time to trigger the action. The format is HH:MM.. + * + * @param time The target time to trigger the action. The format is HH:MM. + * @return the next definition stage. + */ + WithCreate withTime(String time); + } + /** The stage of the Schedule definition allowing to specify timeZone. */ + interface WithTimeZone { + /** + * Specifies the timeZone property: The IANA timezone id at which the schedule should execute.. + * + * @param timeZone The IANA timezone id at which the schedule should execute. + * @return the next definition stage. + */ + WithCreate withTimeZone(String timeZone); + } + /** The stage of the Schedule definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Indicates whether or not this scheduled task is enabled.. + * + * @param state Indicates whether or not this scheduled task is enabled. + * @return the next definition stage. + */ + WithCreate withState(EnableStatus state); + } + /** The stage of the Schedule definition allowing to specify top. */ + interface WithTop { + /** + * Specifies the top property: The maximum number of resources to return from the operation. Example: + * '$top=10'.. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @return the next definition stage. + */ + WithCreate withTop(Integer top); + } + } + /** + * Begins update for the Schedule resource. + * + * @return the stage of resource update. + */ + Schedule.Update update(); + + /** The template for Schedule update. */ + interface Update + extends UpdateStages.WithTypePropertiesType, + UpdateStages.WithFrequency, + UpdateStages.WithTime, + UpdateStages.WithTimeZone, + UpdateStages.WithState, + UpdateStages.WithTop { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Schedule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Schedule apply(Context context); + } + /** The Schedule update stages. */ + interface UpdateStages { + /** The stage of the Schedule update allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Supported type this scheduled task represents.. + * + * @param typePropertiesType Supported type this scheduled task represents. + * @return the next definition stage. + */ + Update withTypePropertiesType(ScheduledType typePropertiesType); + } + /** The stage of the Schedule update allowing to specify frequency. */ + interface WithFrequency { + /** + * Specifies the frequency property: The frequency of this scheduled task.. + * + * @param frequency The frequency of this scheduled task. + * @return the next definition stage. + */ + Update withFrequency(ScheduledFrequency frequency); + } + /** The stage of the Schedule update allowing to specify time. */ + interface WithTime { + /** + * Specifies the time property: The target time to trigger the action. The format is HH:MM.. + * + * @param time The target time to trigger the action. The format is HH:MM. + * @return the next definition stage. + */ + Update withTime(String time); + } + /** The stage of the Schedule update allowing to specify timeZone. */ + interface WithTimeZone { + /** + * Specifies the timeZone property: The IANA timezone id at which the schedule should execute.. + * + * @param timeZone The IANA timezone id at which the schedule should execute. + * @return the next definition stage. + */ + Update withTimeZone(String timeZone); + } + /** The stage of the Schedule update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Indicates whether or not this scheduled task is enabled.. + * + * @param state Indicates whether or not this scheduled task is enabled. + * @return the next definition stage. + */ + Update withState(EnableStatus state); + } + /** The stage of the Schedule update allowing to specify top. */ + interface WithTop { + /** + * Specifies the top property: The maximum number of resources to return from the operation. Example: + * '$top=10'.. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @return the next definition stage. + */ + Update withTop(Integer top); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Schedule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Schedule refresh(Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduleListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduleListResult.java new file mode 100644 index 000000000000..a416cec27790 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduleListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.ScheduleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the schedule list operation. */ +@Immutable +public final class ScheduleListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduleUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduleUpdate.java new file mode 100644 index 000000000000..aac8eada6eed --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduleUpdate.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.devcenter.fluent.models.ScheduleUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The schedule properties for partial update. Properties not provided in the update request will not be changed. */ +@Fluent +public final class ScheduleUpdate extends TrackedResourceUpdate { + /* + * Properties of a schedule resource to be updated. + */ + @JsonProperty(value = "properties") + private ScheduleUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Properties of a schedule resource to be updated. + * + * @return the innerProperties value. + */ + private ScheduleUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ScheduleUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduleUpdate withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Get the type property: Supported type this scheduled task represents. + * + * @return the type value. + */ + public ScheduledType type() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Supported type this scheduled task represents. + * + * @param type the type value to set. + * @return the ScheduleUpdate object itself. + */ + public ScheduleUpdate withType(ScheduledType type) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleUpdateProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the frequency property: The frequency of this scheduled task. + * + * @return the frequency value. + */ + public ScheduledFrequency frequency() { + return this.innerProperties() == null ? null : this.innerProperties().frequency(); + } + + /** + * Set the frequency property: The frequency of this scheduled task. + * + * @param frequency the frequency value to set. + * @return the ScheduleUpdate object itself. + */ + public ScheduleUpdate withFrequency(ScheduledFrequency frequency) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleUpdateProperties(); + } + this.innerProperties().withFrequency(frequency); + return this; + } + + /** + * Get the time property: The target time to trigger the action. The format is HH:MM. + * + * @return the time value. + */ + public String time() { + return this.innerProperties() == null ? null : this.innerProperties().time(); + } + + /** + * Set the time property: The target time to trigger the action. The format is HH:MM. + * + * @param time the time value to set. + * @return the ScheduleUpdate object itself. + */ + public ScheduleUpdate withTime(String time) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleUpdateProperties(); + } + this.innerProperties().withTime(time); + return this; + } + + /** + * Get the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.innerProperties() == null ? null : this.innerProperties().timeZone(); + } + + /** + * Set the timeZone property: The IANA timezone id at which the schedule should execute. + * + * @param timeZone the timeZone value to set. + * @return the ScheduleUpdate object itself. + */ + public ScheduleUpdate withTimeZone(String timeZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleUpdateProperties(); + } + this.innerProperties().withTimeZone(timeZone); + return this; + } + + /** + * Get the state property: Indicates whether or not this scheduled task is enabled. + * + * @return the state value. + */ + public EnableStatus state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Indicates whether or not this scheduled task is enabled. + * + * @param state the state value to set. + * @return the ScheduleUpdate object itself. + */ + public ScheduleUpdate withState(EnableStatus state) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduleUpdateProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduledFrequency.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduledFrequency.java new file mode 100644 index 000000000000..75df9fee21d1 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduledFrequency.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScheduledFrequency. */ +public final class ScheduledFrequency extends ExpandableStringEnum { + /** Static value Daily for ScheduledFrequency. */ + public static final ScheduledFrequency DAILY = fromString("Daily"); + + /** + * Creates or finds a ScheduledFrequency from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScheduledFrequency. + */ + @JsonCreator + public static ScheduledFrequency fromString(String name) { + return fromString(name, ScheduledFrequency.class); + } + + /** + * Gets known ScheduledFrequency values. + * + * @return known ScheduledFrequency values. + */ + public static Collection values() { + return values(ScheduledFrequency.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduledType.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduledType.java new file mode 100644 index 000000000000..6d2d8a7e045e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/ScheduledType.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScheduledType. */ +public final class ScheduledType extends ExpandableStringEnum { + /** Static value StopDevBox for ScheduledType. */ + public static final ScheduledType STOP_DEV_BOX = fromString("StopDevBox"); + + /** + * Creates or finds a ScheduledType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScheduledType. + */ + @JsonCreator + public static ScheduledType fromString(String name) { + return fromString(name, ScheduledType.class); + } + + /** + * Gets known ScheduledType values. + * + * @return known ScheduledType values. + */ + public static Collection values() { + return values(ScheduledType.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Schedules.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Schedules.java new file mode 100644 index 000000000000..dc3f6310b81f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Schedules.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.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 Schedules. */ +public interface Schedules { + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @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 result of the schedule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByPool(String resourceGroupName, String projectName, String poolName); + + /** + * Lists schedules for a pool. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 result of the schedule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByPool( + String resourceGroupName, String projectName, String poolName, Integer top, Context context); + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 schedule resource. + */ + Schedule get(String resourceGroupName, String projectName, String poolName, String scheduleName); + + /** + * Gets a schedule resource. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + Integer top, + Context context); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @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 update( + String resourceGroupName, String projectName, String poolName, String scheduleName, ScheduleUpdate body); + + /** + * Partially updates a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param body Represents a scheduled task. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 update( + String resourceGroupName, + String projectName, + String poolName, + String scheduleName, + ScheduleUpdate body, + Integer top, + Context context); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 projectName, String poolName, String scheduleName, Integer top); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @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 projectName, String poolName, String scheduleName); + + /** + * Deletes a Scheduled. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param projectName The name of the project. + * @param poolName Name of the pool. + * @param scheduleName The name of the schedule that uniquely identifies it. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 projectName, + String poolName, + String scheduleName, + Integer top, + Context context); + + /** + * Gets a schedule resource. + * + * @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 a schedule resource along with {@link Response}. + */ + Schedule getById(String id); + + /** + * Gets a schedule resource. + * + * @param id the resource ID. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 schedule resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Integer top, Context context); + + /** + * Deletes a Scheduled. + * + * @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 a Scheduled. + * + * @param id the resource ID. + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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, Integer top, Context context); + + /** + * Begins definition for a new Schedule resource. + * + * @param name resource name. + * @return the first stage of the new Schedule definition. + */ + Schedule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Sku.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Sku.java new file mode 100644 index 000000000000..3390faf9fd70 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Sku.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.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource model definition representing SKU. */ +@Fluent +public class Sku { + /* + * The name of the SKU. Ex - P3. It is typically a letter+number code + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /* + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @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: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @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: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.class); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/SkuListResult.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/SkuListResult.java new file mode 100644 index 000000000000..2a3cd2d171e3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/SkuListResult.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the Microsoft.DevCenter SKU list operation. */ +@Immutable +public final class SkuListResult { + /* + * Current page of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Current page of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of 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/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/SkuTier.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/SkuTier.java new file mode 100644 index 000000000000..506743e4cc4a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/SkuTier.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.devcenter.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SkuTier. */ +public enum SkuTier { + /** Enum value Free. */ + FREE("Free"), + + /** Enum value Basic. */ + BASIC("Basic"), + + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Premium. */ + PREMIUM("Premium"); + + /** The actual serialized value for a SkuTier instance. */ + private final String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + @JsonCreator + public static SkuTier fromString(String value) { + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Skus.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Skus.java new file mode 100644 index 000000000000..d8ecece0d020 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Skus.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.devcenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Skus. */ +public interface Skus { + /** + * Lists the Microsoft.DevCenter SKUs available in 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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists the Microsoft.DevCenter SKUs available in a subscription. + * + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @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 results of the Microsoft.DevCenter SKU list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Integer top, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/TrackedResourceUpdate.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/TrackedResourceUpdate.java new file mode 100644 index 000000000000..ddddf6c0d524 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/TrackedResourceUpdate.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Base tracked resource type for PATCH updates. */ +@Fluent +public class TrackedResourceUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TrackedResourceUpdate object itself. + */ + public TrackedResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the TrackedResourceUpdate object itself. + */ + public TrackedResourceUpdate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Usage.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Usage.java new file mode 100644 index 000000000000..4c9eba99c7a8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Usage.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.devcenter.models; + +import com.azure.resourcemanager.devcenter.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the currentValue property: The current usage. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the limit property: The limit integer. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the unit property: The unit details. + * + * @return the unit value. + */ + UsageUnit unit(); + + /** + * Gets the name property: The name. + * + * @return the name value. + */ + UsageName name(); + + /** + * Gets the inner com.azure.resourcemanager.devcenter.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UsageName.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UsageName.java new file mode 100644 index 000000000000..f4e4da14c537 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UsageName.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Usage Names. */ +@Fluent +public final class UsageName { + /* + * The localized name of the resource. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /* + * The name of the resource. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the localizedValue property: The localized name of the resource. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: The localized name of the resource. + * + * @param localizedValue the localizedValue value to set. + * @return the UsageName object itself. + */ + public UsageName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Get the value property: The name of the resource. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The name of the resource. + * + * @param value the value value to set. + * @return the UsageName object itself. + */ + public UsageName withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UsageUnit.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UsageUnit.java new file mode 100644 index 000000000000..1a8ffbd378e9 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UsageUnit.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.devcenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsageUnit. */ +public final class UsageUnit extends ExpandableStringEnum { + /** Static value Count for UsageUnit. */ + public static final UsageUnit COUNT = fromString("Count"); + + /** + * Creates or finds a UsageUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsageUnit. + */ + @JsonCreator + public static UsageUnit fromString(String name) { + return fromString(name, UsageUnit.class); + } + + /** + * Gets known UsageUnit values. + * + * @return known UsageUnit values. + */ + public static Collection values() { + return values(UsageUnit.class); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Usages.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Usages.java new file mode 100644 index 000000000000..21c8ec9ab14e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/Usages.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.devcenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Usages. */ +public interface Usages { + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String location); + + /** + * Lists the current usages and limits in this location for the provided subscription. + * + * @param location The Azure region. + * @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 Core Usages as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String location, Context context); +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UserAssignedIdentity.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..9e4505ef2132 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UserAssignedIdentity.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.devcenter.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UserRoleAssignmentValue.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UserRoleAssignmentValue.java new file mode 100644 index 000000000000..22f95c2b7d77 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/UserRoleAssignmentValue.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Mapping of user object ID to role assignments. */ +@Fluent +public final class UserRoleAssignmentValue { + /* + * A map of roles to assign to the parent user. + */ + @JsonProperty(value = "roles") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map roles; + + /** + * Get the roles property: A map of roles to assign to the parent user. + * + * @return the roles value. + */ + public Map roles() { + return this.roles; + } + + /** + * Set the roles property: A map of roles to assign to the parent user. + * + * @param roles the roles value to set. + * @return the UserRoleAssignmentValue object itself. + */ + public UserRoleAssignmentValue withRoles(Map roles) { + this.roles = roles; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roles() != null) { + roles() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/package-info.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/models/package-info.java new file mode 100644 index 000000000000..0d5aa8a7ee11 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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 DevCenterClient. DevCenter Management API. */ +package com.azure.resourcemanager.devcenter.models; diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/package-info.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/package-info.java new file mode 100644 index 000000000000..054a1e7a34fe --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/com/azure/resourcemanager/devcenter/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 DevCenterClient. DevCenter Management API. */ +package com.azure.resourcemanager.devcenter; diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/module-info.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/main/java/module-info.java new file mode 100644 index 000000000000..3ffe2e01ada3 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/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.devcenter { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.devcenter; + exports com.azure.resourcemanager.devcenter.fluent; + exports com.azure.resourcemanager.devcenter.fluent.models; + exports com.azure.resourcemanager.devcenter.models; + + opens com.azure.resourcemanager.devcenter.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.devcenter.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e225843f209a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksCreateOrUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +/** Samples for AttachedNetworks CreateOrUpdate. */ +public final class AttachedNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_Create.json + */ + /** + * Sample code: AttachedNetworks_Create. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksCreate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .attachedNetworks() + .define("{attachedNetworkConnectionName}") + .withExistingDevcenter("rg1", "Contoso") + .withNetworkConnectionId( + "/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3") + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksDeleteSamples.java new file mode 100644 index 000000000000..63e5af2be984 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks Delete. */ +public final class AttachedNetworksDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_Delete.json + */ + /** + * Sample code: AttachedNetworks_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().delete("rg1", "Contoso", "{attachedNetworkConnectionName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksGetByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksGetByDevCenterSamples.java new file mode 100644 index 000000000000..ea616a380f45 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksGetByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks GetByDevCenter. */ +public final class AttachedNetworksGetByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_GetByDevCenter.json + */ + /** + * Sample code: AttachedNetworks_GetByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksGetByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().getByDevCenterWithResponse("rg1", "Contoso", "network-uswest3", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksGetByProjectSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksGetByProjectSamples.java new file mode 100644 index 000000000000..a87b2108867b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksGetByProjectSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks GetByProject. */ +public final class AttachedNetworksGetByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_GetByProject.json + */ + /** + * Sample code: AttachedNetworks_GetByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksGetByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().getByProjectWithResponse("rg1", "{projectName}", "network-uswest3", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksListByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksListByDevCenterSamples.java new file mode 100644 index 000000000000..7df66ce39d9c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksListByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks ListByDevCenter. */ +public final class AttachedNetworksListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_ListByDevCenter.json + */ + /** + * Sample code: AttachedNetworks_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksListByProjectSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksListByProjectSamples.java new file mode 100644 index 000000000000..72bdc2311b76 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/AttachedNetworksListByProjectSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for AttachedNetworks ListByProject. */ +public final class AttachedNetworksListByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/AttachedNetworks_ListByProject.json + */ + /** + * Sample code: AttachedNetworks_ListByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void attachedNetworksListByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.attachedNetworks().listByProject("rg1", "{projectName}", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..5b0efb9eafe9 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.GitCatalog; + +/** Samples for Catalogs CreateOrUpdate. */ +public final class CatalogsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_CreateAdo.json + */ + /** + * Sample code: Catalogs_CreateOrUpdateAdo. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsCreateOrUpdateAdo(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .catalogs() + .define("{catalogName}") + .withExistingDevcenter("rg1", "Contoso") + .withAdoGit( + new GitCatalog() + .withUri("https://contoso@dev.azure.com/contoso/contosoOrg/_git/centralrepo-fakecontoso") + .withBranch("main") + .withSecretIdentifier("https://contosokv.vault.azure.net/secrets/CentralRepoPat") + .withPath("/templates")) + .create(); + } + + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_CreateGitHub.json + */ + /** + * Sample code: Catalogs_CreateOrUpdateGitHub. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsCreateOrUpdateGitHub(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .catalogs() + .define("{catalogName}") + .withExistingDevcenter("rg1", "Contoso") + .withGitHub( + new GitCatalog() + .withUri("https://github.com/Contoso/centralrepo-fake.git") + .withBranch("main") + .withSecretIdentifier("https://contosokv.vault.azure.net/secrets/CentralRepoPat") + .withPath("/templates")) + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsDeleteSamples.java new file mode 100644 index 000000000000..26fb484bd7cb --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Catalogs Delete. */ +public final class CatalogsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Delete.json + */ + /** + * Sample code: Catalogs_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().delete("rg1", "Contoso", "{catalogName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsGetSamples.java new file mode 100644 index 000000000000..cfd2547f9ac2 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Catalogs Get. */ +public final class CatalogsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Get.json + */ + /** + * Sample code: Catalogs_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().getWithResponse("rg1", "Contoso", "{catalogName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsListByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsListByDevCenterSamples.java new file mode 100644 index 000000000000..f250689cf4b6 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsListByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Catalogs ListByDevCenter. */ +public final class CatalogsListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_List.json + */ + /** + * Sample code: Catalogs_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsSyncSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsSyncSamples.java new file mode 100644 index 000000000000..66e025add153 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsSyncSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Catalogs Sync. */ +public final class CatalogsSyncSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Sync.json + */ + /** + * Sample code: Catalogs_Sync. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsSync(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.catalogs().sync("rg1", "Contoso", "{catalogName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsUpdateSamples.java new file mode 100644 index 000000000000..87315bb329fa --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/CatalogsUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.Catalog; +import com.azure.resourcemanager.devcenter.models.GitCatalog; + +/** Samples for Catalogs Update. */ +public final class CatalogsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Catalogs_Patch.json + */ + /** + * Sample code: Catalogs_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void catalogsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + Catalog resource = + manager.catalogs().getWithResponse("rg1", "Contoso", "{catalogName}", Context.NONE).getValue(); + resource.update().withGitHub(new GitCatalog().withPath("/environments")).apply(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..225222610273 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsCreateOrUpdateSamples.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.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.ImageReference; +import com.azure.resourcemanager.devcenter.models.Sku; + +/** Samples for DevBoxDefinitions CreateOrUpdate. */ +public final class DevBoxDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Create.json + */ + /** + * Sample code: DevBoxDefinitions_Create. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsCreate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .devBoxDefinitions() + .define("WebDevBox") + .withRegion("centralus") + .withExistingDevcenter("rg1", "Contoso") + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0")) + .withSku(new Sku().withName("Preview")) + .withOsStorageType("SSD_1024") + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsDeleteSamples.java new file mode 100644 index 000000000000..70afd8e141e5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions Delete. */ +public final class DevBoxDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Delete.json + */ + /** + * Sample code: DevBoxDefinitions_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().delete("rg1", "Contoso", "WebDevBox", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsGetByProjectSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsGetByProjectSamples.java new file mode 100644 index 000000000000..1b7730a5ba7f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsGetByProjectSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions GetByProject. */ +public final class DevBoxDefinitionsGetByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_GetByProject.json + */ + /** + * Sample code: DevBoxDefinitions_GetByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsGetByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().getByProjectWithResponse("rg1", "ContosoProject", "WebDevBox", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsGetSamples.java new file mode 100644 index 000000000000..06bdc5dcbb09 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions Get. */ +public final class DevBoxDefinitionsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Get.json + */ + /** + * Sample code: DevBoxDefinitions_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().getWithResponse("rg1", "Contoso", "WebDevBox", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsListByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsListByDevCenterSamples.java new file mode 100644 index 000000000000..09d6cc2037fe --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsListByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions ListByDevCenter. */ +public final class DevBoxDefinitionsListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_ListByDevCenter.json + */ + /** + * Sample code: DevBoxDefinitions_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsListByProjectSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsListByProjectSamples.java new file mode 100644 index 000000000000..fdfd7cd2bc73 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsListByProjectSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevBoxDefinitions ListByProject. */ +public final class DevBoxDefinitionsListByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_ListByProject.json + */ + /** + * Sample code: DevBoxDefinitions_ListByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsListByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devBoxDefinitions().listByProject("rg1", "ContosoProject", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsUpdateSamples.java new file mode 100644 index 000000000000..d9cac65033e7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevBoxDefinitionsUpdateSamples.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.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.DevBoxDefinition; +import com.azure.resourcemanager.devcenter.models.ImageReference; + +/** Samples for DevBoxDefinitions Update. */ +public final class DevBoxDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevBoxDefinitions_Patch.json + */ + /** + * Sample code: DevBoxDefinitions_Patch. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devBoxDefinitionsPatch(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + DevBoxDefinition resource = + manager.devBoxDefinitions().getWithResponse("rg1", "Contoso", "WebDevBox", Context.NONE).getValue(); + resource + .update() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/2.0.0")) + .apply(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..326c78e9001e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersCreateOrUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.devcenter.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DevCenters CreateOrUpdate. */ +public final class DevCentersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Create.json + */ + /** + * Sample code: DevCenters_Create. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersCreate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .devCenters() + .define("Contoso") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("CostCode", "12345")) + .create(); + } + + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_CreateWithUserIdentity.json + */ + /** + * Sample code: DevCenters_CreateWithUserIdentity. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersCreateWithUserIdentity(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .devCenters() + .define("Contoso") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("CostCode", "12345")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1", + new UserAssignedIdentity()))) + .create(); + } + + @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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersDeleteSamples.java new file mode 100644 index 000000000000..c02840e0197c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevCenters Delete. */ +public final class DevCentersDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Delete.json + */ + /** + * Sample code: DevCenters_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().delete("rg1", "Contoso", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersGetByResourceGroupSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..a548f7dd586a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersGetByResourceGroupSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevCenters GetByResourceGroup. */ +public final class DevCentersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Get.json + */ + /** + * Sample code: DevCenters_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().getByResourceGroupWithResponse("rg1", "Contoso", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersListByResourceGroupSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersListByResourceGroupSamples.java new file mode 100644 index 000000000000..9730ee9b4ccc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersListByResourceGroupSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevCenters ListByResourceGroup. */ +public final class DevCentersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_ListByResourceGroup.json + */ + /** + * Sample code: DevCenters_ListByResourceGroup. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersListByResourceGroup(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().listByResourceGroup("rg1", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersListSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersListSamples.java new file mode 100644 index 000000000000..0b9b25c94450 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersListSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for DevCenters List. */ +public final class DevCentersListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_ListBySubscription.json + */ + /** + * Sample code: DevCenters_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersListBySubscription(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.devCenters().list(null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersUpdateSamples.java new file mode 100644 index 000000000000..2b13c3cc5fb5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/DevCentersUpdateSamples.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.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.DevCenter; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DevCenters Update. */ +public final class DevCentersUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/DevCenters_Patch.json + */ + /** + * Sample code: DevCenters_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void devCentersUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + DevCenter resource = + manager.devCenters().getByResourceGroupWithResponse("rg1", "Contoso", Context.NONE).getValue(); + resource.update().withTags(mapOf("CostCode", "12345")).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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..99ed1bc8ca63 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesCreateOrUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for EnvironmentTypes CreateOrUpdate. */ +public final class EnvironmentTypesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Put.json + */ + /** + * Sample code: EnvironmentTypes_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .environmentTypes() + .define("{environmentTypeName}") + .withExistingDevcenter("rg1", "Contoso") + .withTags(mapOf("Owner", "superuser")) + .create(); + } + + @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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesDeleteSamples.java new file mode 100644 index 000000000000..9d5bec632f76 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for EnvironmentTypes Delete. */ +public final class EnvironmentTypesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Delete.json + */ + /** + * Sample code: EnvironmentTypes_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.environmentTypes().deleteWithResponse("rg1", "Contoso", "{environmentTypeName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesGetSamples.java new file mode 100644 index 000000000000..a7fb5b3c182a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for EnvironmentTypes Get. */ +public final class EnvironmentTypesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Get.json + */ + /** + * Sample code: EnvironmentTypes_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.environmentTypes().getWithResponse("rg1", "Contoso", "{environmentTypeName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesListByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesListByDevCenterSamples.java new file mode 100644 index 000000000000..c33a7d1976a2 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesListByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for EnvironmentTypes ListByDevCenter. */ +public final class EnvironmentTypesListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_List.json + */ + /** + * Sample code: EnvironmentTypes_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.environmentTypes().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesUpdateSamples.java new file mode 100644 index 000000000000..bfdf045d7dbc --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/EnvironmentTypesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.EnvironmentType; +import java.util.HashMap; +import java.util.Map; + +/** Samples for EnvironmentTypes Update. */ +public final class EnvironmentTypesUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/EnvironmentTypes_Patch.json + */ + /** + * Sample code: EnvironmentTypes_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void environmentTypesUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + EnvironmentType resource = + manager + .environmentTypes() + .getWithResponse("rg1", "Contoso", "{environmentTypeName}", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("Owner", "superuser")).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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a5e03505d981 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesCreateOrUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +/** Samples for Galleries CreateOrUpdate. */ +public final class GalleriesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_Create.json + */ + /** + * Sample code: Galleries_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .galleries() + .define("{galleryName}") + .withExistingDevcenter("rg1", "Contoso") + .withGalleryResourceId( + "/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.Compute/galleries/{galleryName}") + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesDeleteSamples.java new file mode 100644 index 000000000000..aff1e9d32b51 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries Delete. */ +public final class GalleriesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_Delete.json + */ + /** + * Sample code: Galleries_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.galleries().delete("rg1", "Contoso", "{galleryName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesGetSamples.java new file mode 100644 index 000000000000..35607a9ccd3c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries Get. */ +public final class GalleriesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_Get.json + */ + /** + * Sample code: Galleries_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.galleries().getWithResponse("rg1", "Contoso", "{galleryName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesListByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesListByDevCenterSamples.java new file mode 100644 index 000000000000..7d4a2430b6e7 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/GalleriesListByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries ListByDevCenter. */ +public final class GalleriesListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Galleries_List.json + */ + /** + * Sample code: Galleries_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void galleriesListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.galleries().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImageVersionsGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImageVersionsGetSamples.java new file mode 100644 index 000000000000..6ee5706e2193 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImageVersionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for ImageVersions Get. */ +public final class ImageVersionsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ImageVersions_Get.json + */ + /** + * Sample code: Versions_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void versionsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .imageVersions() + .getWithResponse("rg1", "Contoso", "DefaultDevGallery", "Win11", "{versionName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImageVersionsListByImageSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImageVersionsListByImageSamples.java new file mode 100644 index 000000000000..5e9885178da0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImageVersionsListByImageSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for ImageVersions ListByImage. */ +public final class ImageVersionsListByImageSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ImageVersions_List.json + */ + /** + * Sample code: ImageVersions_ListByImage. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imageVersionsListByImage(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.imageVersions().listByImage("rg1", "Contoso", "DefaultDevGallery", "Win11", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesGetSamples.java new file mode 100644 index 000000000000..03311349d567 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Images Get. */ +public final class ImagesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Images_Get.json + */ + /** + * Sample code: Images_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imagesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.images().getWithResponse("rg1", "Contoso", "DefaultDevGallery", "{imageName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesListByDevCenterSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesListByDevCenterSamples.java new file mode 100644 index 000000000000..cbd69f7fc31c --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesListByDevCenterSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Images ListByDevCenter. */ +public final class ImagesListByDevCenterSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Images_ListByDevCenter.json + */ + /** + * Sample code: Images_ListByDevCenter. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imagesListByDevCenter(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.images().listByDevCenter("rg1", "Contoso", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesListByGallerySamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesListByGallerySamples.java new file mode 100644 index 000000000000..79075feef30f --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ImagesListByGallerySamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Images ListByGallery. */ +public final class ImagesListByGallerySamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Images_ListByGallery.json + */ + /** + * Sample code: Images_ListByGallery. + * + * @param manager Entry point to DevCenterManager. + */ + public static void imagesListByGallery(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.images().listByGallery("rg1", "Contoso", "DevGallery", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..53fdf8520079 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsCreateOrUpdateSamples.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.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.DomainJoinType; + +/** Samples for NetworkConnections CreateOrUpdate. */ +public final class NetworkConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Put.json + */ + /** + * Sample code: NetworkConnections_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .networkConnections() + .define("uswest3network") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withNetworkingResourceGroupName("NetworkInterfaces") + .withDomainJoinType(DomainJoinType.HYBRID_AZURE_ADJOIN) + .withSubnetId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default") + .withDomainName("mydomaincontroller.local") + .withDomainUsername("testuser@mydomaincontroller.local") + .withDomainPassword("Password value for user") + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsDeleteSamples.java new file mode 100644 index 000000000000..d21c2fd3fb2d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections Delete. */ +public final class NetworkConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Delete.json + */ + /** + * Sample code: NetworkConnections_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().delete("rg1", "{networkConnectionName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsGetByResourceGroupSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..83c7929e88e0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsGetByResourceGroupSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections GetByResourceGroup. */ +public final class NetworkConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Get.json + */ + /** + * Sample code: NetworkConnections_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().getByResourceGroupWithResponse("rg1", "uswest3network", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsGetHealthDetailsSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsGetHealthDetailsSamples.java new file mode 100644 index 000000000000..569ac1530523 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsGetHealthDetailsSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections GetHealthDetails. */ +public final class NetworkConnectionsGetHealthDetailsSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_GetHealthDetails.json + */ + /** + * Sample code: NetworkConnections_GetHealthDetails. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsGetHealthDetails( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().getHealthDetailsWithResponse("rg1", "{networkConnectionName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListByResourceGroupSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListByResourceGroupSamples.java new file mode 100644 index 000000000000..86a8efabaa8e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListByResourceGroupSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections ListByResourceGroup. */ +public final class NetworkConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_ListByResourceGroup.json + */ + /** + * Sample code: NetworkConnections_ListByResourceGroup. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsListByResourceGroup( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().listByResourceGroup("rg1", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListHealthDetailsSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListHealthDetailsSamples.java new file mode 100644 index 000000000000..18685757f566 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListHealthDetailsSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections ListHealthDetails. */ +public final class NetworkConnectionsListHealthDetailsSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_ListHealthDetails.json + */ + /** + * Sample code: NetworkConnections_ListHealthDetails. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsListHealthDetails( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().listHealthDetails("rg1", "uswest3network", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListSamples.java new file mode 100644 index 000000000000..06b0dd84ca99 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsListSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections List. */ +public final class NetworkConnectionsListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_ListBySubscription.json + */ + /** + * Sample code: NetworkConnections_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsListBySubscription( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().list(null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsRunHealthChecksSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsRunHealthChecksSamples.java new file mode 100644 index 000000000000..1e43fc8e3587 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsRunHealthChecksSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkConnections RunHealthChecks. */ +public final class NetworkConnectionsRunHealthChecksSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_RunHealthChecks.json + */ + /** + * Sample code: NetworkConnections_RunHealthChecks. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsRunHealthChecks(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.networkConnections().runHealthChecksWithResponse("rg1", "uswest3network", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsUpdateSamples.java new file mode 100644 index 000000000000..727563873476 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/NetworkConnectionsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.NetworkConnection; + +/** Samples for NetworkConnections Update. */ +public final class NetworkConnectionsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/NetworkConnections_Patch.json + */ + /** + * Sample code: NetworkConnections_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void networkConnectionsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + NetworkConnection resource = + manager + .networkConnections() + .getByResourceGroupWithResponse("rg1", "uswest3network", Context.NONE) + .getValue(); + resource.update().withDomainPassword("New Password value for user").apply(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/OperationStatusesGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/OperationStatusesGetSamples.java new file mode 100644 index 000000000000..477748bb4055 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/OperationStatusesGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for OperationStatuses Get. */ +public final class OperationStatusesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/OperationStatus_Get.json + */ + /** + * Sample code: Get OperationStatus. + * + * @param manager Entry point to DevCenterManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.operationStatuses().getWithResponse("{location}", "{operationId}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/OperationsListSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/OperationsListSamples.java new file mode 100644 index 000000000000..d52ffad9d07a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/OperationsListSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Operations_Get.json + */ + /** + * Sample code: Operations_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void operationsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..2a95be96b22a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsCreateOrUpdateSamples.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.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.LicenseType; +import com.azure.resourcemanager.devcenter.models.LocalAdminStatus; + +/** Samples for Pools CreateOrUpdate. */ +public final class PoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Put.json + */ + /** + * Sample code: Pools_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .pools() + .define("{poolName}") + .withRegion("centralus") + .withExistingProject("rg1", "{projectName}") + .withDevBoxDefinitionName("WebDevBox") + .withNetworkConnectionName("Network1-westus2") + .withLicenseType(LicenseType.WINDOWS_CLIENT) + .withLocalAdministrator(LocalAdminStatus.ENABLED) + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsDeleteSamples.java new file mode 100644 index 000000000000..01c77e24df7e --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Pools Delete. */ +public final class PoolsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Delete.json + */ + /** + * Sample code: Pools_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.pools().delete("rg1", "{projectName}", "poolName", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsGetSamples.java new file mode 100644 index 000000000000..725a37751921 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Pools Get. */ +public final class PoolsGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Get.json + */ + /** + * Sample code: Pools_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.pools().getWithResponse("rg1", "{projectName}", "{poolName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsListByProjectSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsListByProjectSamples.java new file mode 100644 index 000000000000..c9f109bb8c08 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsListByProjectSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Pools ListByProject. */ +public final class PoolsListByProjectSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_List.json + */ + /** + * Sample code: Pools_ListByProject. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsListByProject(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.pools().listByProject("rg1", "{projectName}", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsUpdateSamples.java new file mode 100644 index 000000000000..a26bd6b5f3e8 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/PoolsUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.Pool; + +/** Samples for Pools Update. */ +public final class PoolsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Pools_Patch.json + */ + /** + * Sample code: Pools_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void poolsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + Pool resource = manager.pools().getWithResponse("rg1", "{projectName}", "{poolName}", Context.NONE).getValue(); + resource.update().withDevBoxDefinitionName("WebDevBox2").apply(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e79e3e3d56d5 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesCreateOrUpdateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.EnvironmentRole; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment; +import com.azure.resourcemanager.devcenter.models.UserAssignedIdentity; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProjectEnvironmentTypes CreateOrUpdate. */ +public final class ProjectEnvironmentTypesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Put.json + */ + /** + * Sample code: ProjectEnvironmentTypes_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesCreateOrUpdate( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .projectEnvironmentTypes() + .define("{environmentTypeName}") + .withExistingProject("rg1", "ContosoProj") + .withTags(mapOf("CostCenter", "RnD")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1", + new UserAssignedIdentity()))) + .withDeploymentTargetId("/subscriptions/00000000-0000-0000-0000-000000000000") + .withStatus(EnableStatus.ENABLED) + .withCreatorRoleAssignment( + new ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment() + .withRoles(mapOf("4cbf0b6c-e750-441c-98a7-10da8387e4d6", new EnvironmentRole()))) + .withUserRoleAssignments( + mapOf( + "e45e3m7c-176e-416a-b466-0c5ec8298f8a", + new UserRoleAssignmentValue() + .withRoles(mapOf("4cbf0b6c-e750-441c-98a7-10da8387e4d6", new EnvironmentRole())))) + .create(); + } + + @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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesDeleteSamples.java new file mode 100644 index 000000000000..483a9d2b1443 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for ProjectEnvironmentTypes Delete. */ +public final class ProjectEnvironmentTypesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Delete.json + */ + /** + * Sample code: ProjectEnvironmentTypes_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .projectEnvironmentTypes() + .deleteWithResponse("rg1", "ContosoProj", "{environmentTypeName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesGetSamples.java new file mode 100644 index 000000000000..525df5854201 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for ProjectEnvironmentTypes Get. */ +public final class ProjectEnvironmentTypesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Get.json + */ + /** + * Sample code: ProjectEnvironmentTypes_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projectEnvironmentTypes().getWithResponse("rg1", "ContosoProj", "{environmentTypeName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesListSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesListSamples.java new file mode 100644 index 000000000000..c3fb004e2af4 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesListSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for ProjectEnvironmentTypes List. */ +public final class ProjectEnvironmentTypesListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_List.json + */ + /** + * Sample code: ProjectEnvironmentTypes_List. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesList(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projectEnvironmentTypes().list("rg1", "ContosoProj", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesUpdateSamples.java new file mode 100644 index 000000000000..ff2c0c2a78fd --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectEnvironmentTypesUpdateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.EnvironmentRole; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.devcenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.devcenter.models.ProjectEnvironmentType; +import com.azure.resourcemanager.devcenter.models.UserAssignedIdentity; +import com.azure.resourcemanager.devcenter.models.UserRoleAssignmentValue; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProjectEnvironmentTypes Update. */ +public final class ProjectEnvironmentTypesUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/ProjectEnvironmentTypes_Patch.json + */ + /** + * Sample code: ProjectEnvironmentTypes_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectEnvironmentTypesUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + ProjectEnvironmentType resource = + manager + .projectEnvironmentTypes() + .getWithResponse("rg1", "ContosoProj", "{environmentTypeName}", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("CostCenter", "RnD")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1", + new UserAssignedIdentity()))) + .withDeploymentTargetId("/subscriptions/00000000-0000-0000-0000-000000000000") + .withStatus(EnableStatus.ENABLED) + .withUserRoleAssignments( + mapOf( + "e45e3m7c-176e-416a-b466-0c5ec8298f8a", + new UserRoleAssignmentValue() + .withRoles(mapOf("4cbf0b6c-e750-441c-98a7-10da8387e4d6", new EnvironmentRole())))) + .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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e04d8c558363 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devcenter.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for Projects CreateOrUpdate. */ +public final class ProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Put.json + */ + /** + * Sample code: Projects_CreateOrUpdate. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsCreateOrUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .projects() + .define("{projectName}") + .withRegion("centralus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("CostCenter", "R&D")) + .withDevCenterId( + "/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/{devCenterName}") + .withDescription("This is my first project.") + .create(); + } + + @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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsDeleteSamples.java new file mode 100644 index 000000000000..23118fdb71fe --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects Delete. */ +public final class ProjectsDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Delete.json + */ + /** + * Sample code: Projects_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().delete("rg1", "{projectName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsGetByResourceGroupSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..8e27ee416e5b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsGetByResourceGroupSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects GetByResourceGroup. */ +public final class ProjectsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Get.json + */ + /** + * Sample code: Projects_Get. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsGet(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().getByResourceGroupWithResponse("rg1", "{projectName}", Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsListByResourceGroupSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsListByResourceGroupSamples.java new file mode 100644 index 000000000000..779d9afe6909 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsListByResourceGroupSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects ListByResourceGroup. */ +public final class ProjectsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_ListByResourceGroup.json + */ + /** + * Sample code: Projects_ListByResourceGroup. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsListByResourceGroup(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().listByResourceGroup("rg1", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsListSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsListSamples.java new file mode 100644 index 000000000000..3a79e4a755a2 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsListSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Projects List. */ +public final class ProjectsListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_ListBySubscription.json + */ + /** + * Sample code: Projects_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsListBySubscription(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.projects().list(null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsUpdateSamples.java new file mode 100644 index 000000000000..0ab0b1c4261d --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/ProjectsUpdateSamples.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.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.Project; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Projects Update. */ +public final class ProjectsUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Projects_Patch.json + */ + /** + * Sample code: Projects_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void projectsUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + Project resource = + manager.projects().getByResourceGroupWithResponse("rg1", "{projectName}", Context.NONE).getValue(); + resource.update().withTags(mapOf("CostCenter", "R&D")).withDescription("This is my first project.").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/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesCreateOrUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a54b84a0686b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesCreateOrUpdateSamples.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.devcenter.generated; + +import com.azure.resourcemanager.devcenter.models.EnableStatus; +import com.azure.resourcemanager.devcenter.models.ScheduledFrequency; +import com.azure.resourcemanager.devcenter.models.ScheduledType; + +/** Samples for Schedules CreateOrUpdate. */ +public final class SchedulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_CreateDailyShutdownPoolSchedule.json + */ + /** + * Sample code: Schedules_CreateDailyShutdownPoolSchedule. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesCreateDailyShutdownPoolSchedule( + com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .schedules() + .define("autoShutdown") + .withExistingPool("rg1", "DevProject", "DevPool") + .withTypePropertiesType(ScheduledType.STOP_DEV_BOX) + .withFrequency(ScheduledFrequency.DAILY) + .withTime("17:30") + .withTimeZone("America/Los_Angeles") + .withState(EnableStatus.ENABLED) + .create(); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesDeleteSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesDeleteSamples.java new file mode 100644 index 000000000000..bc9796b3dfa1 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesDeleteSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Schedules Delete. */ +public final class SchedulesDeleteSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_Delete.json + */ + /** + * Sample code: Schedules_Delete. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesDelete(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.schedules().delete("rg1", "TestProject", "DevPool", "autoShutdown", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesGetSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesGetSamples.java new file mode 100644 index 000000000000..0259bf690fb0 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesGetSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Schedules Get. */ +public final class SchedulesGetSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_Get.json + */ + /** + * Sample code: Schedules_GetByPool. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesGetByPool(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.schedules().getWithResponse("rg1", "TestProject", "DevPool", "autoShutdown", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesListByPoolSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesListByPoolSamples.java new file mode 100644 index 000000000000..823b8cb6b37a --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesListByPoolSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Schedules ListByPool. */ +public final class SchedulesListByPoolSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_ListByPool.json + */ + /** + * Sample code: Schedules_ListByPool. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesListByPool(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.schedules().listByPool("rg1", "TestProject", "DevPool", null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesUpdateSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesUpdateSamples.java new file mode 100644 index 000000000000..74b90f6a6269 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SchedulesUpdateSamples.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.devcenter.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devcenter.models.ScheduleUpdate; + +/** Samples for Schedules Update. */ +public final class SchedulesUpdateSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Schedules_Patch.json + */ + /** + * Sample code: Schedules_Update. + * + * @param manager Entry point to DevCenterManager. + */ + public static void schedulesUpdate(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager + .schedules() + .update( + "rg1", + "TestProject", + "DevPool", + "autoShutdown", + new ScheduleUpdate().withTime("18:00"), + null, + Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SkusListSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SkusListSamples.java new file mode 100644 index 000000000000..22458da6de5b --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/SkusListSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Skus List. */ +public final class SkusListSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Skus_ListBySubscription.json + */ + /** + * Sample code: Skus_ListBySubscription. + * + * @param manager Entry point to DevCenterManager. + */ + public static void skusListBySubscription(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.skus().list(null, Context.NONE); + } +} diff --git a/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/UsagesListByLocationSamples.java b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/UsagesListByLocationSamples.java new file mode 100644 index 000000000000..1f299c9aa612 --- /dev/null +++ b/sdk/devcenter/azure-resourcemanager-devcenter/src/samples/java/com/azure/resourcemanager/devcenter/generated/UsagesListByLocationSamples.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.devcenter.generated; + +import com.azure.core.util.Context; + +/** Samples for Usages ListByLocation. */ +public final class UsagesListByLocationSamples { + /* + * x-ms-original-file: specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-08-01-preview/examples/Usages_ListByLocation.json + */ + /** + * Sample code: listUsages. + * + * @param manager Entry point to DevCenterManager. + */ + public static void listUsages(com.azure.resourcemanager.devcenter.DevCenterManager manager) { + manager.usages().listByLocation("westus", Context.NONE); + } +} diff --git a/sdk/devcenter/ci.yml b/sdk/devcenter/ci.yml new file mode 100644 index 000000000000..21e0ecac0912 --- /dev/null +++ b/sdk/devcenter/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/devcenter/ci.yml + - sdk/devcenter/azure-resourcemanager-devcenter/ + exclude: + - sdk/devcenter/pom.xml + - sdk/devcenter/azure-resourcemanager-devcenter/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devcenter/ci.yml + - sdk/devcenter/azure-resourcemanager-devcenter/ + exclude: + - sdk/devcenter/pom.xml + - sdk/devcenter/azure-resourcemanager-devcenter/pom.xml + +parameters: + - name: release_azureresourcemanagerdevcenter + displayName: azure-resourcemanager-devcenter + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: devcenter + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-devcenter + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdevcenter + releaseInBatch: ${{ parameters.release_azureresourcemanagerdevcenter }} diff --git a/sdk/devcenter/pom.xml b/sdk/devcenter/pom.xml new file mode 100644 index 000000000000..3911d24c6acf --- /dev/null +++ b/sdk/devcenter/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-devcenter-service + pom + 1.0.0 + + + azure-resourcemanager-devcenter + +