diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0591ff21a072..d18d0a265f0a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -471,6 +471,7 @@ com.azure.resourcemanager:azure-resourcemanager-computefleet;1.0.0-beta.2;1.0.0- com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redhatopenshift;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-kubernetesruntime;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;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 2016ea2e3bf3..ecda23c1cc93 100644 --- a/pom.xml +++ b/pom.xml @@ -118,6 +118,7 @@ sdk/iothub sdk/keyvault sdk/kubernetesconfiguration + sdk/kubernetesruntime sdk/kusto sdk/labservices sdk/largeinstance diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/CHANGELOG.md b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/CHANGELOG.md new file mode 100644 index 000000000000..f33966aba91a --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-09-19) + +- Azure Resource Manager kubernetesruntime client library for Java. This package contains Microsoft Azure SDK for kubernetesruntime Management SDK. Package tag package-2024-03-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-kubernetesruntime Java SDK. diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/README.md b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/README.md new file mode 100644 index 000000000000..330a3e8d8c9d --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager kubernetesruntime client library for Java + +Azure Resource Manager kubernetesruntime client library for Java. + +This package contains Microsoft Azure SDK for kubernetesruntime Management SDK. Package tag package-2024-03-01. 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-kubernetesruntime;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-kubernetesruntime + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +KubernetesruntimeManager manager = KubernetesruntimeManager + .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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fkubernetesruntime%2Fazure-resourcemanager-kubernetesruntime%2FREADME.png) diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/SAMPLE.md b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/SAMPLE.md new file mode 100644 index 000000000000..d22948180c4a --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/SAMPLE.md @@ -0,0 +1,546 @@ +# Code snippets and samples + + +## BgpPeers + +- [CreateOrUpdate](#bgppeers_createorupdate) +- [Delete](#bgppeers_delete) +- [Get](#bgppeers_get) +- [List](#bgppeers_list) + +## LoadBalancers + +- [CreateOrUpdate](#loadbalancers_createorupdate) +- [Delete](#loadbalancers_delete) +- [Get](#loadbalancers_get) +- [List](#loadbalancers_list) + +## Operations + +- [List](#operations_list) + +## Services + +- [CreateOrUpdate](#services_createorupdate) +- [Delete](#services_delete) +- [Get](#services_get) +- [List](#services_list) + +## StorageClass + +- [CreateOrUpdate](#storageclass_createorupdate) +- [Delete](#storageclass_delete) +- [Get](#storageclass_get) +- [List](#storageclass_list) +- [Update](#storageclass_update) +### BgpPeers_CreateOrUpdate + +```java +/** + * Samples for BgpPeers CreateOrUpdate. + */ +public final class BgpPeersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_CreateOrUpdate.json + */ + /** + * Sample code: BgpPeers_CreateOrUpdate. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + bgpPeersCreateOrUpdate(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .define("testpeer") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .withMyAsn(64500) + .withPeerAsn(64501) + .withPeerAddress("10.0.0.1") + .create(); + } +} +``` + +### BgpPeers_Delete + +```java +/** + * Samples for BgpPeers Delete. + */ +public final class BgpPeersDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_Delete.json + */ + /** + * Sample code: BgpPeers_Delete. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void bgpPeersDelete(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .deleteByResourceGroupWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testpeer", com.azure.core.util.Context.NONE); + } +} +``` + +### BgpPeers_Get + +```java +/** + * Samples for BgpPeers Get. + */ +public final class BgpPeersGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_Get.json + */ + /** + * Sample code: BgpPeers_Get. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void bgpPeersGet(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testpeer", com.azure.core.util.Context.NONE); + } +} +``` + +### BgpPeers_List + +```java +/** + * Samples for BgpPeers List. + */ +public final class BgpPeersListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_List.json + */ + /** + * Sample code: BgpPeers_List. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void bgpPeersList(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} +``` + +### LoadBalancers_CreateOrUpdate + +```java +import com.azure.resourcemanager.kubernetesruntime.models.AdvertiseMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for LoadBalancers CreateOrUpdate. + */ +public final class LoadBalancersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_CreateOrUpdate.json + */ + /** + * Sample code: LoadBalancers_CreateOrUpdate. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + loadBalancersCreateOrUpdate(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .define("testlb") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .withAddresses(Arrays.asList("192.168.50.1/24", "192.168.51.2-192.168.51.10")) + .withServiceSelector(mapOf("app", "frontend")) + .withAdvertiseMode(AdvertiseMode.ARP) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### LoadBalancers_Delete + +```java +/** + * Samples for LoadBalancers Delete. + */ +public final class LoadBalancersDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_Delete.json + */ + /** + * Sample code: LoadBalancers_Delete. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + loadBalancersDelete(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .deleteByResourceGroupWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testlb", com.azure.core.util.Context.NONE); + } +} +``` + +### LoadBalancers_Get + +```java +/** + * Samples for LoadBalancers Get. + */ +public final class LoadBalancersGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_Get.json + */ + /** + * Sample code: LoadBalancers_Get. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void loadBalancersGet(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testlb", com.azure.core.util.Context.NONE); + } +} +``` + +### LoadBalancers_List + +```java +/** + * Samples for LoadBalancers List. + */ +public final class LoadBalancersListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_List.json + */ + /** + * Sample code: LoadBalancers_List. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void loadBalancersList(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Operations_List.json + */ + /** + * Sample code: Operations_List_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void operationsList0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Services_CreateOrUpdate + +```java +/** + * Samples for Services CreateOrUpdate. + */ +public final class ServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_CreateOrUpdate.json + */ + /** + * Sample code: Services_CreateOrUpdate. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + servicesCreateOrUpdate(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .define("storageclass") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .create(); + } +} +``` + +### Services_Delete + +```java +/** + * Samples for Services Delete. + */ +public final class ServicesDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_Delete.json + */ + /** + * Sample code: Services_Delete. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void servicesDelete(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .deleteByResourceGroupWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "storageclass", com.azure.core.util.Context.NONE); + } +} +``` + +### Services_Get + +```java +/** + * Samples for Services Get. + */ +public final class ServicesGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_Get.json + */ + /** + * Sample code: Services_Get. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void servicesGet(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "storageclass", com.azure.core.util.Context.NONE); + } +} +``` + +### Services_List + +```java +/** + * Samples for Services List. + */ +public final class ServicesListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_List.json + */ + /** + * Sample code: Services_List. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void servicesList(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} +``` + +### StorageClass_CreateOrUpdate + +```java +import com.azure.resourcemanager.kubernetesruntime.models.RwxStorageClassTypeProperties; + +/** + * Samples for StorageClass CreateOrUpdate. + */ +public final class StorageClassCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_CreateOrUpdate.json + */ + /** + * Sample code: StorageClass_CreateOrUpdate_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + storageClassCreateOrUpdate0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .define("testrwx") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .withTypeProperties(new RwxStorageClassTypeProperties().withBackingStorageClassName("default")) + .create(); + } +} +``` + +### StorageClass_Delete + +```java +/** + * Samples for StorageClass Delete. + */ +public final class StorageClassDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_Delete.json + */ + /** + * Sample code: StorageClass_Delete_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + storageClassDelete0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .delete( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testrwx", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageClass_Get + +```java +/** + * Samples for StorageClass Get. + */ +public final class StorageClassGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_Get.json + */ + /** + * Sample code: StorageClass_Get_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void storageClassGet0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testrwx", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageClass_List + +```java +/** + * Samples for StorageClass List. + */ +public final class StorageClassListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_List.json + */ + /** + * Sample code: StorageClass_List_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void storageClassList0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} +``` + +### StorageClass_Update + +```java +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassPropertiesUpdate; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResource; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassTypePropertiesUpdate; + +/** + * Samples for StorageClass Update. + */ +public final class StorageClassUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_Update.json + */ + /** + * Sample code: StorageClass_Update_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + storageClassUpdate0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + StorageClassResource resource = manager.storageClass() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testrwx", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new StorageClassPropertiesUpdate() + .withTypeProperties(new StorageClassTypePropertiesUpdate().withBackingStorageClassName("default"))) + .apply(); + } +} +``` + diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/pom.xml b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/pom.xml new file mode 100644 index 000000000000..9991d58e5f88 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-kubernetesruntime + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for kubernetesruntime Management + This package contains Microsoft Azure SDK for kubernetesruntime Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-03-01. + 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 + 0 + 0 + true + + + + com.azure + azure-json + 1.3.0 + + + com.azure + azure-core + 1.52.0 + + + com.azure + azure-core-management + 1.15.3 + + + diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/KubernetesruntimeManager.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/KubernetesruntimeManager.java new file mode 100644 index 000000000000..99bda2dbcec2 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/KubernetesruntimeManager.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime; + +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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.kubernetesruntime.fluent.MicrosoftKubernetesRuntime; +import com.azure.resourcemanager.kubernetesruntime.implementation.BgpPeersImpl; +import com.azure.resourcemanager.kubernetesruntime.implementation.LoadBalancersImpl; +import com.azure.resourcemanager.kubernetesruntime.implementation.MicrosoftKubernetesRuntimeBuilder; +import com.azure.resourcemanager.kubernetesruntime.implementation.OperationsImpl; +import com.azure.resourcemanager.kubernetesruntime.implementation.ServicesImpl; +import com.azure.resourcemanager.kubernetesruntime.implementation.StorageClassImpl; +import com.azure.resourcemanager.kubernetesruntime.models.BgpPeers; +import com.azure.resourcemanager.kubernetesruntime.models.LoadBalancers; +import com.azure.resourcemanager.kubernetesruntime.models.Operations; +import com.azure.resourcemanager.kubernetesruntime.models.Services; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClass; +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 KubernetesruntimeManager. + */ +public final class KubernetesruntimeManager { + private BgpPeers bgpPeers; + + private LoadBalancers loadBalancers; + + private Services services; + + private StorageClass storageClass; + + private Operations operations; + + private final MicrosoftKubernetesRuntime clientObject; + + private KubernetesruntimeManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MicrosoftKubernetesRuntimeBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of kubernetesruntime service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the kubernetesruntime service API instance. + */ + public static KubernetesruntimeManager 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 kubernetesruntime service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the kubernetesruntime service API instance. + */ + public static KubernetesruntimeManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new KubernetesruntimeManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create KubernetesruntimeManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new KubernetesruntimeManager.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 kubernetesruntime service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the kubernetesruntime service API instance. + */ + public KubernetesruntimeManager 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.kubernetesruntime") + .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 KubernetesruntimeManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of BgpPeers. It manages BgpPeer. + * + * @return Resource collection API of BgpPeers. + */ + public BgpPeers bgpPeers() { + if (this.bgpPeers == null) { + this.bgpPeers = new BgpPeersImpl(clientObject.getBgpPeers(), this); + } + return bgpPeers; + } + + /** + * Gets the resource collection API of LoadBalancers. It manages LoadBalancer. + * + * @return Resource collection API of LoadBalancers. + */ + public LoadBalancers loadBalancers() { + if (this.loadBalancers == null) { + this.loadBalancers = new LoadBalancersImpl(clientObject.getLoadBalancers(), this); + } + return loadBalancers; + } + + /** + * Gets the resource collection API of Services. It manages ServiceResource. + * + * @return Resource collection API of Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** + * Gets the resource collection API of StorageClass. It manages StorageClassResource. + * + * @return Resource collection API of StorageClass. + */ + public StorageClass storageClass() { + if (this.storageClass == null) { + this.storageClass = new StorageClassImpl(clientObject.getStorageClass(), this); + } + return storageClass; + } + + /** + * 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 wrapped service client MicrosoftKubernetesRuntime providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client MicrosoftKubernetesRuntime. + */ + public MicrosoftKubernetesRuntime serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/BgpPeersClient.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/BgpPeersClient.java new file mode 100644 index 000000000000..84f7e645a051 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/BgpPeersClient.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.models.BgpPeerInner; + +/** + * An instance of this class provides access to all the operations defined in BgpPeersClient. + */ +public interface BgpPeersClient { + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @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 BgpPeer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String bgpPeerName, Context context); + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 BgpPeer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BgpPeerInner get(String resourceUri, String bgpPeerName); + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 BgpPeer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BgpPeerInner> beginCreateOrUpdate(String resourceUri, String bgpPeerName, + BgpPeerInner resource); + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @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 BgpPeer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BgpPeerInner> beginCreateOrUpdate(String resourceUri, String bgpPeerName, + BgpPeerInner resource, Context context); + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BgpPeerInner createOrUpdate(String resourceUri, String bgpPeerName, BgpPeerInner resource); + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BgpPeerInner createOrUpdate(String resourceUri, String bgpPeerName, BgpPeerInner resource, Context context); + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @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 resourceUri, String bgpPeerName, Context context); + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String bgpPeerName); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/LoadBalancersClient.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/LoadBalancersClient.java new file mode 100644 index 000000000000..1bf3c560e402 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/LoadBalancersClient.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.models.LoadBalancerInner; + +/** + * An instance of this class provides access to all the operations defined in LoadBalancersClient. + */ +public interface LoadBalancersClient { + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @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 LoadBalancer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String loadBalancerName, Context context); + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 LoadBalancer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadBalancerInner get(String resourceUri, String loadBalancerName); + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 LoadBalancer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LoadBalancerInner> beginCreateOrUpdate(String resourceUri, + String loadBalancerName, LoadBalancerInner resource); + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @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 LoadBalancer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LoadBalancerInner> beginCreateOrUpdate(String resourceUri, + String loadBalancerName, LoadBalancerInner resource, Context context); + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadBalancerInner createOrUpdate(String resourceUri, String loadBalancerName, LoadBalancerInner resource); + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadBalancerInner createOrUpdate(String resourceUri, String loadBalancerName, LoadBalancerInner resource, + Context context); + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @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 resourceUri, String loadBalancerName, Context context); + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String loadBalancerName); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/MicrosoftKubernetesRuntime.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/MicrosoftKubernetesRuntime.java new file mode 100644 index 000000000000..806626e977df --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/MicrosoftKubernetesRuntime.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MicrosoftKubernetesRuntime class. + */ +public interface MicrosoftKubernetesRuntime { + /** + * 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 BgpPeersClient object to access its operations. + * + * @return the BgpPeersClient object. + */ + BgpPeersClient getBgpPeers(); + + /** + * Gets the LoadBalancersClient object to access its operations. + * + * @return the LoadBalancersClient object. + */ + LoadBalancersClient getLoadBalancers(); + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + ServicesClient getServices(); + + /** + * Gets the StorageClassClient object to access its operations. + * + * @return the StorageClassClient object. + */ + StorageClassClient getStorageClass(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/OperationsClient.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/OperationsClient.java new file mode 100644 index 000000000000..7610dc4b8e65 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.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(); + + /** + * List the operations for the provider. + * + * @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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/ServicesClient.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/ServicesClient.java new file mode 100644 index 000000000000..d57264f58a8d --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/ServicesClient.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.kubernetesruntime.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.kubernetesruntime.fluent.models.ServiceResourceInner; + +/** + * An instance of this class provides access to all the operations defined in ServicesClient. + */ +public interface ServicesClient { + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @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 ServiceResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String serviceName, Context context); + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ServiceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner get(String resourceUri, String serviceName); + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceUri, String serviceName, + ServiceResourceInner resource, Context context); + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner createOrUpdate(String resourceUri, String serviceName, ServiceResourceInner resource); + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @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 resourceUri, String serviceName, Context context); + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String serviceName); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/StorageClassClient.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/StorageClassClient.java new file mode 100644 index 000000000000..89fbce07c83e --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/StorageClassClient.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.models.StorageClassResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in StorageClassClient. + */ +public interface StorageClassClient { + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @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 StorageClassResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String storageClassName, Context context); + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 StorageClassResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageClassResourceInner get(String resourceUri, String storageClassName); + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageClassResourceInner> beginCreateOrUpdate(String resourceUri, + String storageClassName, StorageClassResourceInner resource); + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageClassResourceInner> beginCreateOrUpdate(String resourceUri, + String storageClassName, StorageClassResourceInner resource, Context context); + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageClassResourceInner createOrUpdate(String resourceUri, String storageClassName, + StorageClassResourceInner resource); + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageClassResourceInner createOrUpdate(String resourceUri, String storageClassName, + StorageClassResourceInner resource, Context context); + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageClassResourceInner> beginUpdate(String resourceUri, + String storageClassName, StorageClassResourceUpdate properties); + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageClassResourceInner> beginUpdate(String resourceUri, + String storageClassName, StorageClassResourceUpdate properties, Context context); + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageClassResourceInner update(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties); + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageClassResourceInner update(String resourceUri, String storageClassName, StorageClassResourceUpdate properties, + Context context); + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 resourceUri, String storageClassName); + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @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 resourceUri, String storageClassName, Context context); + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String storageClassName); + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @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 resourceUri, String storageClassName, Context context); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/BgpPeerInner.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/BgpPeerInner.java new file mode 100644 index 000000000000..d0462d44b88b --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/BgpPeerInner.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.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.io.IOException; + +/** + * A BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ +@Fluent +public final class BgpPeerInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private BgpPeerProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BgpPeerInner class. + */ + public BgpPeerInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private BgpPeerProperties 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the myAsn property: My ASN. + * + * @return the myAsn value. + */ + public Integer myAsn() { + return this.innerProperties() == null ? null : this.innerProperties().myAsn(); + } + + /** + * Set the myAsn property: My ASN. + * + * @param myAsn the myAsn value to set. + * @return the BgpPeerInner object itself. + */ + public BgpPeerInner withMyAsn(Integer myAsn) { + if (this.innerProperties() == null) { + this.innerProperties = new BgpPeerProperties(); + } + this.innerProperties().withMyAsn(myAsn); + return this; + } + + /** + * Get the peerAsn property: Peer ASN. + * + * @return the peerAsn value. + */ + public Integer peerAsn() { + return this.innerProperties() == null ? null : this.innerProperties().peerAsn(); + } + + /** + * Set the peerAsn property: Peer ASN. + * + * @param peerAsn the peerAsn value to set. + * @return the BgpPeerInner object itself. + */ + public BgpPeerInner withPeerAsn(Integer peerAsn) { + if (this.innerProperties() == null) { + this.innerProperties = new BgpPeerProperties(); + } + this.innerProperties().withPeerAsn(peerAsn); + return this; + } + + /** + * Get the peerAddress property: Peer Address. + * + * @return the peerAddress value. + */ + public String peerAddress() { + return this.innerProperties() == null ? null : this.innerProperties().peerAddress(); + } + + /** + * Set the peerAddress property: Peer Address. + * + * @param peerAddress the peerAddress value to set. + * @return the BgpPeerInner object itself. + */ + public BgpPeerInner withPeerAddress(String peerAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new BgpPeerProperties(); + } + this.innerProperties().withPeerAddress(peerAddress); + return this; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BgpPeerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BgpPeerInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BgpPeerInner. + */ + public static BgpPeerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BgpPeerInner deserializedBgpPeerInner = new BgpPeerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBgpPeerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBgpPeerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBgpPeerInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedBgpPeerInner.innerProperties = BgpPeerProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedBgpPeerInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBgpPeerInner; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/BgpPeerProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/BgpPeerProperties.java new file mode 100644 index 000000000000..030b39971957 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/BgpPeerProperties.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.io.IOException; + +/** + * Details of the BgpPeer. + */ +@Fluent +public final class BgpPeerProperties implements JsonSerializable { + /* + * My ASN + */ + private int myAsn; + + /* + * Peer ASN + */ + private int peerAsn; + + /* + * Peer Address + */ + private String peerAddress; + + /* + * Resource provision state + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of BgpPeerProperties class. + */ + public BgpPeerProperties() { + } + + /** + * Get the myAsn property: My ASN. + * + * @return the myAsn value. + */ + public int myAsn() { + return this.myAsn; + } + + /** + * Set the myAsn property: My ASN. + * + * @param myAsn the myAsn value to set. + * @return the BgpPeerProperties object itself. + */ + public BgpPeerProperties withMyAsn(int myAsn) { + this.myAsn = myAsn; + return this; + } + + /** + * Get the peerAsn property: Peer ASN. + * + * @return the peerAsn value. + */ + public int peerAsn() { + return this.peerAsn; + } + + /** + * Set the peerAsn property: Peer ASN. + * + * @param peerAsn the peerAsn value to set. + * @return the BgpPeerProperties object itself. + */ + public BgpPeerProperties withPeerAsn(int peerAsn) { + this.peerAsn = peerAsn; + return this; + } + + /** + * Get the peerAddress property: Peer Address. + * + * @return the peerAddress value. + */ + public String peerAddress() { + return this.peerAddress; + } + + /** + * Set the peerAddress property: Peer Address. + * + * @param peerAddress the peerAddress value to set. + * @return the BgpPeerProperties object itself. + */ + public BgpPeerProperties withPeerAddress(String peerAddress) { + this.peerAddress = peerAddress; + return this; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (peerAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property peerAddress in model BgpPeerProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BgpPeerProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("myAsn", this.myAsn); + jsonWriter.writeIntField("peerAsn", this.peerAsn); + jsonWriter.writeStringField("peerAddress", this.peerAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BgpPeerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BgpPeerProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BgpPeerProperties. + */ + public static BgpPeerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BgpPeerProperties deserializedBgpPeerProperties = new BgpPeerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("myAsn".equals(fieldName)) { + deserializedBgpPeerProperties.myAsn = reader.getInt(); + } else if ("peerAsn".equals(fieldName)) { + deserializedBgpPeerProperties.peerAsn = reader.getInt(); + } else if ("peerAddress".equals(fieldName)) { + deserializedBgpPeerProperties.peerAddress = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedBgpPeerProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBgpPeerProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/LoadBalancerInner.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/LoadBalancerInner.java new file mode 100644 index 000000000000..8a224e6ce1f7 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/LoadBalancerInner.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.AdvertiseMode; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ +@Fluent +public final class LoadBalancerInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private LoadBalancerProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of LoadBalancerInner class. + */ + public LoadBalancerInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private LoadBalancerProperties 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the addresses property: IP Range. + * + * @return the addresses value. + */ + public List addresses() { + return this.innerProperties() == null ? null : this.innerProperties().addresses(); + } + + /** + * Set the addresses property: IP Range. + * + * @param addresses the addresses value to set. + * @return the LoadBalancerInner object itself. + */ + public LoadBalancerInner withAddresses(List addresses) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadBalancerProperties(); + } + this.innerProperties().withAddresses(addresses); + return this; + } + + /** + * Get the serviceSelector property: A dynamic label mapping to select related services. For instance, if you want + * to create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * + * @return the serviceSelector value. + */ + public Map serviceSelector() { + return this.innerProperties() == null ? null : this.innerProperties().serviceSelector(); + } + + /** + * Set the serviceSelector property: A dynamic label mapping to select related services. For instance, if you want + * to create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * + * @param serviceSelector the serviceSelector value to set. + * @return the LoadBalancerInner object itself. + */ + public LoadBalancerInner withServiceSelector(Map serviceSelector) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadBalancerProperties(); + } + this.innerProperties().withServiceSelector(serviceSelector); + return this; + } + + /** + * Get the advertiseMode property: Advertise Mode. + * + * @return the advertiseMode value. + */ + public AdvertiseMode advertiseMode() { + return this.innerProperties() == null ? null : this.innerProperties().advertiseMode(); + } + + /** + * Set the advertiseMode property: Advertise Mode. + * + * @param advertiseMode the advertiseMode value to set. + * @return the LoadBalancerInner object itself. + */ + public LoadBalancerInner withAdvertiseMode(AdvertiseMode advertiseMode) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadBalancerProperties(); + } + this.innerProperties().withAdvertiseMode(advertiseMode); + return this; + } + + /** + * Get the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * + * @return the bgpPeers value. + */ + public List bgpPeers() { + return this.innerProperties() == null ? null : this.innerProperties().bgpPeers(); + } + + /** + * Set the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * + * @param bgpPeers the bgpPeers value to set. + * @return the LoadBalancerInner object itself. + */ + public LoadBalancerInner withBgpPeers(List bgpPeers) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadBalancerProperties(); + } + this.innerProperties().withBgpPeers(bgpPeers); + return this; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadBalancerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadBalancerInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LoadBalancerInner. + */ + public static LoadBalancerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadBalancerInner deserializedLoadBalancerInner = new LoadBalancerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLoadBalancerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedLoadBalancerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedLoadBalancerInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedLoadBalancerInner.innerProperties = LoadBalancerProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedLoadBalancerInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadBalancerInner; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/LoadBalancerProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/LoadBalancerProperties.java new file mode 100644 index 000000000000..03146f85c03c --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/LoadBalancerProperties.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.AdvertiseMode; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Details of the LoadBalancer. + */ +@Fluent +public final class LoadBalancerProperties implements JsonSerializable { + /* + * IP Range + */ + private List addresses; + + /* + * A dynamic label mapping to select related services. For instance, if you want to create a load balancer only for + * services with label "a=b", then please specify {"a": "b"} in the field. + */ + private Map serviceSelector; + + /* + * Advertise Mode + */ + private AdvertiseMode advertiseMode; + + /* + * The list of BGP peers it should advertise to. Null or empty means to advertise to all peers. + */ + private List bgpPeers; + + /* + * Resource provision state + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of LoadBalancerProperties class. + */ + public LoadBalancerProperties() { + } + + /** + * Get the addresses property: IP Range. + * + * @return the addresses value. + */ + public List addresses() { + return this.addresses; + } + + /** + * Set the addresses property: IP Range. + * + * @param addresses the addresses value to set. + * @return the LoadBalancerProperties object itself. + */ + public LoadBalancerProperties withAddresses(List addresses) { + this.addresses = addresses; + return this; + } + + /** + * Get the serviceSelector property: A dynamic label mapping to select related services. For instance, if you want + * to create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * + * @return the serviceSelector value. + */ + public Map serviceSelector() { + return this.serviceSelector; + } + + /** + * Set the serviceSelector property: A dynamic label mapping to select related services. For instance, if you want + * to create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * + * @param serviceSelector the serviceSelector value to set. + * @return the LoadBalancerProperties object itself. + */ + public LoadBalancerProperties withServiceSelector(Map serviceSelector) { + this.serviceSelector = serviceSelector; + return this; + } + + /** + * Get the advertiseMode property: Advertise Mode. + * + * @return the advertiseMode value. + */ + public AdvertiseMode advertiseMode() { + return this.advertiseMode; + } + + /** + * Set the advertiseMode property: Advertise Mode. + * + * @param advertiseMode the advertiseMode value to set. + * @return the LoadBalancerProperties object itself. + */ + public LoadBalancerProperties withAdvertiseMode(AdvertiseMode advertiseMode) { + this.advertiseMode = advertiseMode; + return this; + } + + /** + * Get the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * + * @return the bgpPeers value. + */ + public List bgpPeers() { + return this.bgpPeers; + } + + /** + * Set the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * + * @param bgpPeers the bgpPeers value to set. + * @return the LoadBalancerProperties object itself. + */ + public LoadBalancerProperties withBgpPeers(List bgpPeers) { + this.bgpPeers = bgpPeers; + return this; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (addresses() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property addresses in model LoadBalancerProperties")); + } + if (advertiseMode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property advertiseMode in model LoadBalancerProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LoadBalancerProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("addresses", this.addresses, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("advertiseMode", this.advertiseMode == null ? null : this.advertiseMode.toString()); + jsonWriter.writeMapField("serviceSelector", this.serviceSelector, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("bgpPeers", this.bgpPeers, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadBalancerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadBalancerProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LoadBalancerProperties. + */ + public static LoadBalancerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadBalancerProperties deserializedLoadBalancerProperties = new LoadBalancerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("addresses".equals(fieldName)) { + List addresses = reader.readArray(reader1 -> reader1.getString()); + deserializedLoadBalancerProperties.addresses = addresses; + } else if ("advertiseMode".equals(fieldName)) { + deserializedLoadBalancerProperties.advertiseMode = AdvertiseMode.fromString(reader.getString()); + } else if ("serviceSelector".equals(fieldName)) { + Map serviceSelector = reader.readMap(reader1 -> reader1.getString()); + deserializedLoadBalancerProperties.serviceSelector = serviceSelector; + } else if ("bgpPeers".equals(fieldName)) { + List bgpPeers = reader.readArray(reader1 -> reader1.getString()); + deserializedLoadBalancerProperties.bgpPeers = bgpPeers; + } else if ("provisioningState".equals(fieldName)) { + deserializedLoadBalancerProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadBalancerProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/OperationInner.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/OperationInner.java new file mode 100644 index 000000000000..fbaee80d72a3 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/OperationInner.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.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.ActionType; +import com.azure.resourcemanager.kubernetesruntime.models.OperationDisplay; +import com.azure.resourcemanager.kubernetesruntime.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/ServiceProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/ServiceProperties.java new file mode 100644 index 000000000000..93366b17c075 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/ServiceProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.io.IOException; + +/** + * Properties for the service resource. + */ +@Immutable +public final class ServiceProperties implements JsonSerializable { + /* + * The object id of the service principal of the RP provisioned in the tenant + */ + private String rpObjectId; + + /* + * Resource provision state + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ServiceProperties class. + */ + public ServiceProperties() { + } + + /** + * Get the rpObjectId property: The object id of the service principal of the RP provisioned in the tenant. + * + * @return the rpObjectId value. + */ + public String rpObjectId() { + return this.rpObjectId; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceProperties. + */ + public static ServiceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceProperties deserializedServiceProperties = new ServiceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rpObjectId".equals(fieldName)) { + deserializedServiceProperties.rpObjectId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedServiceProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/ServiceResourceInner.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/ServiceResourceInner.java new file mode 100644 index 000000000000..67dd660d2e82 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/ServiceResourceInner.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.io.IOException; + +/** + * A Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ +@Immutable +public final class ServiceResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ServiceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ServiceResourceInner class. + */ + public ServiceResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ServiceProperties 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the rpObjectId property: The object id of the service principal of the RP provisioned in the tenant. + * + * @return the rpObjectId value. + */ + public String rpObjectId() { + return this.innerProperties() == null ? null : this.innerProperties().rpObjectId(); + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServiceResourceInner. + */ + public static ServiceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceInner deserializedServiceResourceInner = new ServiceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServiceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServiceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServiceResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServiceResourceInner.innerProperties = ServiceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedServiceResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceResourceInner; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/StorageClassProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/StorageClassProperties.java new file mode 100644 index 000000000000..ce6593abc505 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/StorageClassProperties.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.AccessMode; +import com.azure.resourcemanager.kubernetesruntime.models.DataResilienceTier; +import com.azure.resourcemanager.kubernetesruntime.models.FailoverTier; +import com.azure.resourcemanager.kubernetesruntime.models.PerformanceTier; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassTypeProperties; +import com.azure.resourcemanager.kubernetesruntime.models.VolumeBindingMode; +import com.azure.resourcemanager.kubernetesruntime.models.VolumeExpansion; +import java.io.IOException; +import java.util.List; + +/** + * Details of the StorageClass StorageClass. + */ +@Fluent +public final class StorageClassProperties implements JsonSerializable { + /* + * Volume can be expanded or not + */ + private VolumeExpansion allowVolumeExpansion; + + /* + * Additional mount options + */ + private List mountOptions; + + /* + * Provisioner name + */ + private String provisioner; + + /* + * Binding mode of volumes: Immediate, WaitForFirstConsumer + */ + private VolumeBindingMode volumeBindingMode; + + /* + * The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce] + */ + private List accessModes; + + /* + * Allow single data node failure + */ + private DataResilienceTier dataResilience; + + /* + * Failover speed: NA, Slow, Fast + */ + private FailoverTier failoverSpeed; + + /* + * Limitations of the storage class + */ + private List limitations; + + /* + * Performance tier + */ + private PerformanceTier performance; + + /* + * Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: Never use + */ + private Long priority; + + /* + * Properties of the StorageClass + */ + private StorageClassTypeProperties typeProperties; + + /* + * Resource provision state + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of StorageClassProperties class. + */ + public StorageClassProperties() { + } + + /** + * Get the allowVolumeExpansion property: Volume can be expanded or not. + * + * @return the allowVolumeExpansion value. + */ + public VolumeExpansion allowVolumeExpansion() { + return this.allowVolumeExpansion; + } + + /** + * Set the allowVolumeExpansion property: Volume can be expanded or not. + * + * @param allowVolumeExpansion the allowVolumeExpansion value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withAllowVolumeExpansion(VolumeExpansion allowVolumeExpansion) { + this.allowVolumeExpansion = allowVolumeExpansion; + return this; + } + + /** + * Get the mountOptions property: Additional mount options. + * + * @return the mountOptions value. + */ + public List mountOptions() { + return this.mountOptions; + } + + /** + * Set the mountOptions property: Additional mount options. + * + * @param mountOptions the mountOptions value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withMountOptions(List mountOptions) { + this.mountOptions = mountOptions; + return this; + } + + /** + * Get the provisioner property: Provisioner name. + * + * @return the provisioner value. + */ + public String provisioner() { + return this.provisioner; + } + + /** + * Set the provisioner property: Provisioner name. + * + * @param provisioner the provisioner value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withProvisioner(String provisioner) { + this.provisioner = provisioner; + return this; + } + + /** + * Get the volumeBindingMode property: Binding mode of volumes: Immediate, WaitForFirstConsumer. + * + * @return the volumeBindingMode value. + */ + public VolumeBindingMode volumeBindingMode() { + return this.volumeBindingMode; + } + + /** + * Set the volumeBindingMode property: Binding mode of volumes: Immediate, WaitForFirstConsumer. + * + * @param volumeBindingMode the volumeBindingMode value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withVolumeBindingMode(VolumeBindingMode volumeBindingMode) { + this.volumeBindingMode = volumeBindingMode; + return this; + } + + /** + * Get the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @return the accessModes value. + */ + public List accessModes() { + return this.accessModes; + } + + /** + * Set the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @param accessModes the accessModes value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withAccessModes(List accessModes) { + this.accessModes = accessModes; + return this; + } + + /** + * Get the dataResilience property: Allow single data node failure. + * + * @return the dataResilience value. + */ + public DataResilienceTier dataResilience() { + return this.dataResilience; + } + + /** + * Set the dataResilience property: Allow single data node failure. + * + * @param dataResilience the dataResilience value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withDataResilience(DataResilienceTier dataResilience) { + this.dataResilience = dataResilience; + return this; + } + + /** + * Get the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @return the failoverSpeed value. + */ + public FailoverTier failoverSpeed() { + return this.failoverSpeed; + } + + /** + * Set the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @param failoverSpeed the failoverSpeed value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withFailoverSpeed(FailoverTier failoverSpeed) { + this.failoverSpeed = failoverSpeed; + return this; + } + + /** + * Get the limitations property: Limitations of the storage class. + * + * @return the limitations value. + */ + public List limitations() { + return this.limitations; + } + + /** + * Set the limitations property: Limitations of the storage class. + * + * @param limitations the limitations value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withLimitations(List limitations) { + this.limitations = limitations; + return this; + } + + /** + * Get the performance property: Performance tier. + * + * @return the performance value. + */ + public PerformanceTier performance() { + return this.performance; + } + + /** + * Set the performance property: Performance tier. + * + * @param performance the performance value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withPerformance(PerformanceTier performance) { + this.performance = performance; + return this; + } + + /** + * Get the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @return the priority value. + */ + public Long priority() { + return this.priority; + } + + /** + * Set the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @param priority the priority value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withPriority(Long priority) { + this.priority = priority; + return this; + } + + /** + * Get the typeProperties property: Properties of the StorageClass. + * + * @return the typeProperties value. + */ + public StorageClassTypeProperties typeProperties() { + return this.typeProperties; + } + + /** + * Set the typeProperties property: Properties of the StorageClass. + * + * @param typeProperties the typeProperties value to set. + * @return the StorageClassProperties object itself. + */ + public StorageClassProperties withTypeProperties(StorageClassTypeProperties typeProperties) { + this.typeProperties = typeProperties; + return this; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (typeProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property typeProperties in model StorageClassProperties")); + } else { + typeProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageClassProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("typeProperties", this.typeProperties); + jsonWriter.writeStringField("allowVolumeExpansion", + this.allowVolumeExpansion == null ? null : this.allowVolumeExpansion.toString()); + jsonWriter.writeArrayField("mountOptions", this.mountOptions, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("provisioner", this.provisioner); + jsonWriter.writeStringField("volumeBindingMode", + this.volumeBindingMode == null ? null : this.volumeBindingMode.toString()); + jsonWriter.writeArrayField("accessModes", this.accessModes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("dataResilience", + this.dataResilience == null ? null : this.dataResilience.toString()); + jsonWriter.writeStringField("failoverSpeed", this.failoverSpeed == null ? null : this.failoverSpeed.toString()); + jsonWriter.writeArrayField("limitations", this.limitations, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("performance", this.performance == null ? null : this.performance.toString()); + jsonWriter.writeNumberField("priority", this.priority); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageClassProperties. + */ + public static StorageClassProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassProperties deserializedStorageClassProperties = new StorageClassProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("typeProperties".equals(fieldName)) { + deserializedStorageClassProperties.typeProperties = StorageClassTypeProperties.fromJson(reader); + } else if ("allowVolumeExpansion".equals(fieldName)) { + deserializedStorageClassProperties.allowVolumeExpansion + = VolumeExpansion.fromString(reader.getString()); + } else if ("mountOptions".equals(fieldName)) { + List mountOptions = reader.readArray(reader1 -> reader1.getString()); + deserializedStorageClassProperties.mountOptions = mountOptions; + } else if ("provisioner".equals(fieldName)) { + deserializedStorageClassProperties.provisioner = reader.getString(); + } else if ("volumeBindingMode".equals(fieldName)) { + deserializedStorageClassProperties.volumeBindingMode + = VolumeBindingMode.fromString(reader.getString()); + } else if ("accessModes".equals(fieldName)) { + List accessModes + = reader.readArray(reader1 -> AccessMode.fromString(reader1.getString())); + deserializedStorageClassProperties.accessModes = accessModes; + } else if ("dataResilience".equals(fieldName)) { + deserializedStorageClassProperties.dataResilience + = DataResilienceTier.fromString(reader.getString()); + } else if ("failoverSpeed".equals(fieldName)) { + deserializedStorageClassProperties.failoverSpeed = FailoverTier.fromString(reader.getString()); + } else if ("limitations".equals(fieldName)) { + List limitations = reader.readArray(reader1 -> reader1.getString()); + deserializedStorageClassProperties.limitations = limitations; + } else if ("performance".equals(fieldName)) { + deserializedStorageClassProperties.performance = PerformanceTier.fromString(reader.getString()); + } else if ("priority".equals(fieldName)) { + deserializedStorageClassProperties.priority = reader.getNullable(JsonReader::getLong); + } else if ("provisioningState".equals(fieldName)) { + deserializedStorageClassProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/StorageClassResourceInner.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/StorageClassResourceInner.java new file mode 100644 index 000000000000..8d0157c1a77f --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/StorageClassResourceInner.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.models.AccessMode; +import com.azure.resourcemanager.kubernetesruntime.models.DataResilienceTier; +import com.azure.resourcemanager.kubernetesruntime.models.FailoverTier; +import com.azure.resourcemanager.kubernetesruntime.models.PerformanceTier; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassTypeProperties; +import com.azure.resourcemanager.kubernetesruntime.models.VolumeBindingMode; +import com.azure.resourcemanager.kubernetesruntime.models.VolumeExpansion; +import java.io.IOException; +import java.util.List; + +/** + * A StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ +@Fluent +public final class StorageClassResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private StorageClassProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of StorageClassResourceInner class. + */ + public StorageClassResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private StorageClassProperties 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the allowVolumeExpansion property: Volume can be expanded or not. + * + * @return the allowVolumeExpansion value. + */ + public VolumeExpansion allowVolumeExpansion() { + return this.innerProperties() == null ? null : this.innerProperties().allowVolumeExpansion(); + } + + /** + * Set the allowVolumeExpansion property: Volume can be expanded or not. + * + * @param allowVolumeExpansion the allowVolumeExpansion value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withAllowVolumeExpansion(VolumeExpansion allowVolumeExpansion) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withAllowVolumeExpansion(allowVolumeExpansion); + return this; + } + + /** + * Get the mountOptions property: Additional mount options. + * + * @return the mountOptions value. + */ + public List mountOptions() { + return this.innerProperties() == null ? null : this.innerProperties().mountOptions(); + } + + /** + * Set the mountOptions property: Additional mount options. + * + * @param mountOptions the mountOptions value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withMountOptions(List mountOptions) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withMountOptions(mountOptions); + return this; + } + + /** + * Get the provisioner property: Provisioner name. + * + * @return the provisioner value. + */ + public String provisioner() { + return this.innerProperties() == null ? null : this.innerProperties().provisioner(); + } + + /** + * Set the provisioner property: Provisioner name. + * + * @param provisioner the provisioner value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withProvisioner(String provisioner) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withProvisioner(provisioner); + return this; + } + + /** + * Get the volumeBindingMode property: Binding mode of volumes: Immediate, WaitForFirstConsumer. + * + * @return the volumeBindingMode value. + */ + public VolumeBindingMode volumeBindingMode() { + return this.innerProperties() == null ? null : this.innerProperties().volumeBindingMode(); + } + + /** + * Set the volumeBindingMode property: Binding mode of volumes: Immediate, WaitForFirstConsumer. + * + * @param volumeBindingMode the volumeBindingMode value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withVolumeBindingMode(VolumeBindingMode volumeBindingMode) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withVolumeBindingMode(volumeBindingMode); + return this; + } + + /** + * Get the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @return the accessModes value. + */ + public List accessModes() { + return this.innerProperties() == null ? null : this.innerProperties().accessModes(); + } + + /** + * Set the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @param accessModes the accessModes value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withAccessModes(List accessModes) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withAccessModes(accessModes); + return this; + } + + /** + * Get the dataResilience property: Allow single data node failure. + * + * @return the dataResilience value. + */ + public DataResilienceTier dataResilience() { + return this.innerProperties() == null ? null : this.innerProperties().dataResilience(); + } + + /** + * Set the dataResilience property: Allow single data node failure. + * + * @param dataResilience the dataResilience value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withDataResilience(DataResilienceTier dataResilience) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withDataResilience(dataResilience); + return this; + } + + /** + * Get the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @return the failoverSpeed value. + */ + public FailoverTier failoverSpeed() { + return this.innerProperties() == null ? null : this.innerProperties().failoverSpeed(); + } + + /** + * Set the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @param failoverSpeed the failoverSpeed value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withFailoverSpeed(FailoverTier failoverSpeed) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withFailoverSpeed(failoverSpeed); + return this; + } + + /** + * Get the limitations property: Limitations of the storage class. + * + * @return the limitations value. + */ + public List limitations() { + return this.innerProperties() == null ? null : this.innerProperties().limitations(); + } + + /** + * Set the limitations property: Limitations of the storage class. + * + * @param limitations the limitations value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withLimitations(List limitations) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withLimitations(limitations); + return this; + } + + /** + * Get the performance property: Performance tier. + * + * @return the performance value. + */ + public PerformanceTier performance() { + return this.innerProperties() == null ? null : this.innerProperties().performance(); + } + + /** + * Set the performance property: Performance tier. + * + * @param performance the performance value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withPerformance(PerformanceTier performance) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withPerformance(performance); + return this; + } + + /** + * Get the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @return the priority value. + */ + public Long priority() { + return this.innerProperties() == null ? null : this.innerProperties().priority(); + } + + /** + * Set the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @param priority the priority value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withPriority(Long priority) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withPriority(priority); + return this; + } + + /** + * Get the typeProperties property: Properties of the StorageClass. + * + * @return the typeProperties value. + */ + public StorageClassTypeProperties typeProperties() { + return this.innerProperties() == null ? null : this.innerProperties().typeProperties(); + } + + /** + * Set the typeProperties property: Properties of the StorageClass. + * + * @param typeProperties the typeProperties value to set. + * @return the StorageClassResourceInner object itself. + */ + public StorageClassResourceInner withTypeProperties(StorageClassTypeProperties typeProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new StorageClassProperties(); + } + this.innerProperties().withTypeProperties(typeProperties); + return this; + } + + /** + * Get the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + public ProvisioningState 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageClassResourceInner. + */ + public static StorageClassResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassResourceInner deserializedStorageClassResourceInner = new StorageClassResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageClassResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStorageClassResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStorageClassResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedStorageClassResourceInner.innerProperties = StorageClassProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStorageClassResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassResourceInner; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/package-info.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/package-info.java new file mode 100644 index 000000000000..b84030b470fd --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftKubernetesRuntime. + * null. + */ +package com.azure.resourcemanager.kubernetesruntime.fluent.models; diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/package-info.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/package-info.java new file mode 100644 index 000000000000..c90cdda49e32 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftKubernetesRuntime. + * null. + */ +package com.azure.resourcemanager.kubernetesruntime.fluent; diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeerImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeerImpl.java new file mode 100644 index 000000000000..94ee9ffed5fa --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeerImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.BgpPeerInner; +import com.azure.resourcemanager.kubernetesruntime.models.BgpPeer; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; + +public final class BgpPeerImpl implements BgpPeer, BgpPeer.Definition, BgpPeer.Update { + private BgpPeerInner innerObject; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager 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 int myAsn() { + return this.innerModel().myAsn(); + } + + public int peerAsn() { + return this.innerModel().peerAsn(); + } + + public String peerAddress() { + return this.innerModel().peerAddress(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public BgpPeerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String bgpPeerName; + + public BgpPeerImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public BgpPeer create() { + this.innerObject = serviceManager.serviceClient() + .getBgpPeers() + .createOrUpdate(resourceUri, bgpPeerName, this.innerModel(), Context.NONE); + return this; + } + + public BgpPeer create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBgpPeers() + .createOrUpdate(resourceUri, bgpPeerName, this.innerModel(), context); + return this; + } + + BgpPeerImpl(String name, com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = new BgpPeerInner(); + this.serviceManager = serviceManager; + this.bgpPeerName = name; + } + + public BgpPeerImpl update() { + return this; + } + + public BgpPeer apply() { + this.innerObject = serviceManager.serviceClient() + .getBgpPeers() + .createOrUpdate(resourceUri, bgpPeerName, this.innerModel(), Context.NONE); + return this; + } + + public BgpPeer apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBgpPeers() + .createOrUpdate(resourceUri, bgpPeerName, this.innerModel(), context); + return this; + } + + BgpPeerImpl(BgpPeerInner innerObject, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "resourceUri"); + this.bgpPeerName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "bgpPeerName"); + } + + public BgpPeer refresh() { + this.innerObject = serviceManager.serviceClient() + .getBgpPeers() + .getWithResponse(resourceUri, bgpPeerName, Context.NONE) + .getValue(); + return this; + } + + public BgpPeer refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBgpPeers() + .getWithResponse(resourceUri, bgpPeerName, context) + .getValue(); + return this; + } + + public BgpPeerImpl withMyAsn(int myAsn) { + this.innerModel().withMyAsn(myAsn); + return this; + } + + public BgpPeerImpl withPeerAsn(int peerAsn) { + this.innerModel().withPeerAsn(peerAsn); + return this; + } + + public BgpPeerImpl withPeerAddress(String peerAddress) { + this.innerModel().withPeerAddress(peerAddress); + return this; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeersClientImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeersClientImpl.java new file mode 100644 index 000000000000..3b0ef92f57b3 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeersClientImpl.java @@ -0,0 +1,714 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.BgpPeersClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.BgpPeerInner; +import com.azure.resourcemanager.kubernetesruntime.models.BgpPeerListResult; +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 BgpPeersClient. + */ +public final class BgpPeersClientImpl implements BgpPeersClient { + /** + * The proxy service used to perform REST calls. + */ + private final BgpPeersService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftKubernetesRuntimeImpl client; + + /** + * Initializes an instance of BgpPeersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BgpPeersClientImpl(MicrosoftKubernetesRuntimeImpl client) { + this.service = RestProxy.create(BgpPeersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftKubernetesRuntimeBgpPeers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftKubernetesR") + public interface BgpPeersService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("bgpPeerName") String bgpPeerName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("bgpPeerName") String bgpPeerName, @BodyParam("application/json") BgpPeerInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("bgpPeerName") String bgpPeerName, @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); + } + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + 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 BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri 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(), resourceUri, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String bgpPeerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (bgpPeerName == null) { + return Mono.error(new IllegalArgumentException("Parameter bgpPeerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + bgpPeerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String bgpPeerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (bgpPeerName == null) { + return Mono.error(new IllegalArgumentException("Parameter bgpPeerName 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(), resourceUri, bgpPeerName, accept, + context); + } + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String bgpPeerName) { + return getWithResponseAsync(resourceUri, bgpPeerName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String bgpPeerName, Context context) { + return getWithResponseAsync(resourceUri, bgpPeerName, context).block(); + } + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BgpPeerInner get(String resourceUri, String bgpPeerName) { + return getWithResponse(resourceUri, bgpPeerName, Context.NONE).getValue(); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, String bgpPeerName, + BgpPeerInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (bgpPeerName == null) { + return Mono.error(new IllegalArgumentException("Parameter bgpPeerName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, bgpPeerName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, String bgpPeerName, + BgpPeerInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (bgpPeerName == null) { + return Mono.error(new IllegalArgumentException("Parameter bgpPeerName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, bgpPeerName, + resource, accept, context); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 BgpPeer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BgpPeerInner> beginCreateOrUpdateAsync(String resourceUri, + String bgpPeerName, BgpPeerInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, bgpPeerName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BgpPeerInner.class, BgpPeerInner.class, this.client.getContext()); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 BgpPeer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BgpPeerInner> beginCreateOrUpdateAsync(String resourceUri, + String bgpPeerName, BgpPeerInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, bgpPeerName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BgpPeerInner.class, BgpPeerInner.class, context); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 BgpPeer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BgpPeerInner> beginCreateOrUpdate(String resourceUri, + String bgpPeerName, BgpPeerInner resource) { + return this.beginCreateOrUpdateAsync(resourceUri, bgpPeerName, resource).getSyncPoller(); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 BgpPeer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BgpPeerInner> beginCreateOrUpdate(String resourceUri, + String bgpPeerName, BgpPeerInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceUri, bgpPeerName, resource, context).getSyncPoller(); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String bgpPeerName, BgpPeerInner resource) { + return beginCreateOrUpdateAsync(resourceUri, bgpPeerName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String bgpPeerName, BgpPeerInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceUri, bgpPeerName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BgpPeerInner createOrUpdate(String resourceUri, String bgpPeerName, BgpPeerInner resource) { + return createOrUpdateAsync(resourceUri, bgpPeerName, resource).block(); + } + + /** + * Create a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BgpPeer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BgpPeerInner createOrUpdate(String resourceUri, String bgpPeerName, BgpPeerInner resource, Context context) { + return createOrUpdateAsync(resourceUri, bgpPeerName, resource, context).block(); + } + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String bgpPeerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (bgpPeerName == null) { + return Mono.error(new IllegalArgumentException("Parameter bgpPeerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + bgpPeerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String bgpPeerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (bgpPeerName == null) { + return Mono.error(new IllegalArgumentException("Parameter bgpPeerName 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(), resourceUri, bgpPeerName, accept, + context); + } + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resourceUri, String bgpPeerName) { + return deleteWithResponseAsync(resourceUri, bgpPeerName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String bgpPeerName, Context context) { + return deleteWithResponseAsync(resourceUri, bgpPeerName, context).block(); + } + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourceUri, String bgpPeerName) { + deleteWithResponse(resourceUri, bgpPeerName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeersImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeersImpl.java new file mode 100644 index 000000000000..89d0a6cdf77a --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/BgpPeersImpl.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.kubernetesruntime.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.kubernetesruntime.fluent.BgpPeersClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.BgpPeerInner; +import com.azure.resourcemanager.kubernetesruntime.models.BgpPeer; +import com.azure.resourcemanager.kubernetesruntime.models.BgpPeers; + +public final class BgpPeersImpl implements BgpPeers { + private static final ClientLogger LOGGER = new ClientLogger(BgpPeersImpl.class); + + private final BgpPeersClient innerClient; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager; + + public BgpPeersImpl(BgpPeersClient innerClient, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BgpPeerImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BgpPeerImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceUri, String bgpPeerName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, bgpPeerName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BgpPeerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BgpPeer get(String resourceUri, String bgpPeerName) { + BgpPeerInner inner = this.serviceClient().get(resourceUri, bgpPeerName); + if (inner != null) { + return new BgpPeerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceUri, String bgpPeerName, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, bgpPeerName, context); + } + + public void deleteByResourceGroup(String resourceUri, String bgpPeerName) { + this.serviceClient().delete(resourceUri, bgpPeerName); + } + + public BgpPeer getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String bgpPeerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "bgpPeerName"); + if (bgpPeerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bgpPeers'.", id))); + } + return this.getWithResponse(resourceUri, bgpPeerName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String bgpPeerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "bgpPeerName"); + if (bgpPeerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bgpPeers'.", id))); + } + return this.getWithResponse(resourceUri, bgpPeerName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String bgpPeerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "bgpPeerName"); + if (bgpPeerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bgpPeers'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceUri, bgpPeerName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String bgpPeerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/bgpPeers/{bgpPeerName}", "bgpPeerName"); + if (bgpPeerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bgpPeers'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceUri, bgpPeerName, context); + } + + private BgpPeersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + public BgpPeerImpl define(String name) { + return new BgpPeerImpl(name, this.manager()); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancerImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancerImpl.java new file mode 100644 index 000000000000..a508eb1e3b4d --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancerImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.LoadBalancerInner; +import com.azure.resourcemanager.kubernetesruntime.models.AdvertiseMode; +import com.azure.resourcemanager.kubernetesruntime.models.LoadBalancer; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class LoadBalancerImpl implements LoadBalancer, LoadBalancer.Definition, LoadBalancer.Update { + private LoadBalancerInner innerObject; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager 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 List addresses() { + List inner = this.innerModel().addresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map serviceSelector() { + Map inner = this.innerModel().serviceSelector(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public AdvertiseMode advertiseMode() { + return this.innerModel().advertiseMode(); + } + + public List bgpPeers() { + List inner = this.innerModel().bgpPeers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public LoadBalancerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String loadBalancerName; + + public LoadBalancerImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public LoadBalancer create() { + this.innerObject = serviceManager.serviceClient() + .getLoadBalancers() + .createOrUpdate(resourceUri, loadBalancerName, this.innerModel(), Context.NONE); + return this; + } + + public LoadBalancer create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLoadBalancers() + .createOrUpdate(resourceUri, loadBalancerName, this.innerModel(), context); + return this; + } + + LoadBalancerImpl(String name, com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = new LoadBalancerInner(); + this.serviceManager = serviceManager; + this.loadBalancerName = name; + } + + public LoadBalancerImpl update() { + return this; + } + + public LoadBalancer apply() { + this.innerObject = serviceManager.serviceClient() + .getLoadBalancers() + .createOrUpdate(resourceUri, loadBalancerName, this.innerModel(), Context.NONE); + return this; + } + + public LoadBalancer apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLoadBalancers() + .createOrUpdate(resourceUri, loadBalancerName, this.innerModel(), context); + return this; + } + + LoadBalancerImpl(LoadBalancerInner innerObject, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", "resourceUri"); + this.loadBalancerName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", + "loadBalancerName"); + } + + public LoadBalancer refresh() { + this.innerObject = serviceManager.serviceClient() + .getLoadBalancers() + .getWithResponse(resourceUri, loadBalancerName, Context.NONE) + .getValue(); + return this; + } + + public LoadBalancer refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLoadBalancers() + .getWithResponse(resourceUri, loadBalancerName, context) + .getValue(); + return this; + } + + public LoadBalancerImpl withAddresses(List addresses) { + this.innerModel().withAddresses(addresses); + return this; + } + + public LoadBalancerImpl withServiceSelector(Map serviceSelector) { + this.innerModel().withServiceSelector(serviceSelector); + return this; + } + + public LoadBalancerImpl withAdvertiseMode(AdvertiseMode advertiseMode) { + this.innerModel().withAdvertiseMode(advertiseMode); + return this; + } + + public LoadBalancerImpl withBgpPeers(List bgpPeers) { + this.innerModel().withBgpPeers(bgpPeers); + return this; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancersClientImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancersClientImpl.java new file mode 100644 index 000000000000..cda7aac31b55 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancersClientImpl.java @@ -0,0 +1,728 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.LoadBalancersClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.LoadBalancerInner; +import com.azure.resourcemanager.kubernetesruntime.models.LoadBalancerListResult; +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 LoadBalancersClient. + */ +public final class LoadBalancersClientImpl implements LoadBalancersClient { + /** + * The proxy service used to perform REST calls. + */ + private final LoadBalancersService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftKubernetesRuntimeImpl client; + + /** + * Initializes an instance of LoadBalancersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LoadBalancersClientImpl(MicrosoftKubernetesRuntimeImpl client) { + this.service + = RestProxy.create(LoadBalancersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftKubernetesRuntimeLoadBalancers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftKubernetesR") + public interface LoadBalancersService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("loadBalancerName") String loadBalancerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("loadBalancerName") String loadBalancerName, + @BodyParam("application/json") LoadBalancerInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("loadBalancerName") String loadBalancerName, @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); + } + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + 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 LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri 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(), resourceUri, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String loadBalancerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (loadBalancerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + loadBalancerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String loadBalancerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (loadBalancerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter loadBalancerName 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(), resourceUri, loadBalancerName, + accept, context); + } + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String loadBalancerName) { + return getWithResponseAsync(resourceUri, loadBalancerName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String loadBalancerName, Context context) { + return getWithResponseAsync(resourceUri, loadBalancerName, context).block(); + } + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadBalancerInner get(String resourceUri, String loadBalancerName) { + return getWithResponse(resourceUri, loadBalancerName, Context.NONE).getValue(); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, + String loadBalancerName, LoadBalancerInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (loadBalancerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, loadBalancerName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, + String loadBalancerName, LoadBalancerInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (loadBalancerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + loadBalancerName, resource, accept, context); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 LoadBalancer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadBalancerInner> beginCreateOrUpdateAsync(String resourceUri, + String loadBalancerName, LoadBalancerInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, loadBalancerName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + LoadBalancerInner.class, LoadBalancerInner.class, this.client.getContext()); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 LoadBalancer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadBalancerInner> beginCreateOrUpdateAsync(String resourceUri, + String loadBalancerName, LoadBalancerInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, loadBalancerName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + LoadBalancerInner.class, LoadBalancerInner.class, context); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 LoadBalancer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LoadBalancerInner> beginCreateOrUpdate(String resourceUri, + String loadBalancerName, LoadBalancerInner resource) { + return this.beginCreateOrUpdateAsync(resourceUri, loadBalancerName, resource).getSyncPoller(); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 LoadBalancer resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LoadBalancerInner> beginCreateOrUpdate(String resourceUri, + String loadBalancerName, LoadBalancerInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceUri, loadBalancerName, resource, context).getSyncPoller(); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String loadBalancerName, + LoadBalancerInner resource) { + return beginCreateOrUpdateAsync(resourceUri, loadBalancerName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String loadBalancerName, + LoadBalancerInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceUri, loadBalancerName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadBalancerInner createOrUpdate(String resourceUri, String loadBalancerName, LoadBalancerInner resource) { + return createOrUpdateAsync(resourceUri, loadBalancerName, resource).block(); + } + + /** + * Create a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 LoadBalancer resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadBalancerInner createOrUpdate(String resourceUri, String loadBalancerName, LoadBalancerInner resource, + Context context) { + return createOrUpdateAsync(resourceUri, loadBalancerName, resource, context).block(); + } + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String loadBalancerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (loadBalancerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + loadBalancerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String loadBalancerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (loadBalancerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter loadBalancerName 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(), resourceUri, loadBalancerName, + accept, context); + } + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resourceUri, String loadBalancerName) { + return deleteWithResponseAsync(resourceUri, loadBalancerName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String loadBalancerName, Context context) { + return deleteWithResponseAsync(resourceUri, loadBalancerName, context).block(); + } + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourceUri, String loadBalancerName) { + deleteWithResponse(resourceUri, loadBalancerName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancersImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancersImpl.java new file mode 100644 index 000000000000..48e48511caff --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/LoadBalancersImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.LoadBalancersClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.LoadBalancerInner; +import com.azure.resourcemanager.kubernetesruntime.models.LoadBalancer; +import com.azure.resourcemanager.kubernetesruntime.models.LoadBalancers; + +public final class LoadBalancersImpl implements LoadBalancers { + private static final ClientLogger LOGGER = new ClientLogger(LoadBalancersImpl.class); + + private final LoadBalancersClient innerClient; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager; + + public LoadBalancersImpl(LoadBalancersClient innerClient, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LoadBalancerImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LoadBalancerImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceUri, String loadBalancerName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, loadBalancerName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new LoadBalancerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LoadBalancer get(String resourceUri, String loadBalancerName) { + LoadBalancerInner inner = this.serviceClient().get(resourceUri, loadBalancerName); + if (inner != null) { + return new LoadBalancerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceUri, String loadBalancerName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, loadBalancerName, context); + } + + public void deleteByResourceGroup(String resourceUri, String loadBalancerName) { + this.serviceClient().delete(resourceUri, loadBalancerName); + } + + public LoadBalancer getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String loadBalancerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", + "loadBalancerName"); + if (loadBalancerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadBalancers'.", id))); + } + return this.getWithResponse(resourceUri, loadBalancerName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String loadBalancerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", + "loadBalancerName"); + if (loadBalancerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadBalancers'.", id))); + } + return this.getWithResponse(resourceUri, loadBalancerName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String loadBalancerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", + "loadBalancerName"); + if (loadBalancerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadBalancers'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceUri, loadBalancerName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String loadBalancerName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/loadBalancers/{loadBalancerName}", + "loadBalancerName"); + if (loadBalancerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadBalancers'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceUri, loadBalancerName, context); + } + + private LoadBalancersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + public LoadBalancerImpl define(String name) { + return new LoadBalancerImpl(name, this.manager()); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/MicrosoftKubernetesRuntimeBuilder.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/MicrosoftKubernetesRuntimeBuilder.java new file mode 100644 index 000000000000..105d4b384f3b --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/MicrosoftKubernetesRuntimeBuilder.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.kubernetesruntime.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 MicrosoftKubernetesRuntimeImpl type. + */ +@ServiceClientBuilder(serviceClients = { MicrosoftKubernetesRuntimeImpl.class }) +public final class MicrosoftKubernetesRuntimeBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftKubernetesRuntimeBuilder. + */ + public MicrosoftKubernetesRuntimeBuilder 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 MicrosoftKubernetesRuntimeBuilder. + */ + public MicrosoftKubernetesRuntimeBuilder 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 MicrosoftKubernetesRuntimeBuilder. + */ + public MicrosoftKubernetesRuntimeBuilder 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 MicrosoftKubernetesRuntimeBuilder. + */ + public MicrosoftKubernetesRuntimeBuilder 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 MicrosoftKubernetesRuntimeBuilder. + */ + public MicrosoftKubernetesRuntimeBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftKubernetesRuntimeImpl with the provided parameters. + * + * @return an instance of MicrosoftKubernetesRuntimeImpl. + */ + public MicrosoftKubernetesRuntimeImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MicrosoftKubernetesRuntimeImpl client = new MicrosoftKubernetesRuntimeImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/MicrosoftKubernetesRuntimeImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/MicrosoftKubernetesRuntimeImpl.java new file mode 100644 index 000000000000..c18360a23c59 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/MicrosoftKubernetesRuntimeImpl.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.PollerFactory; +import com.azure.core.management.polling.PollResult; +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.kubernetesruntime.fluent.BgpPeersClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.LoadBalancersClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.MicrosoftKubernetesRuntime; +import com.azure.resourcemanager.kubernetesruntime.fluent.OperationsClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.ServicesClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.StorageClassClient; +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 MicrosoftKubernetesRuntimeImpl type. + */ +@ServiceClient(builder = MicrosoftKubernetesRuntimeBuilder.class) +public final class MicrosoftKubernetesRuntimeImpl implements MicrosoftKubernetesRuntime { + /** + * 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 BgpPeersClient object to access its operations. + */ + private final BgpPeersClient bgpPeers; + + /** + * Gets the BgpPeersClient object to access its operations. + * + * @return the BgpPeersClient object. + */ + public BgpPeersClient getBgpPeers() { + return this.bgpPeers; + } + + /** + * The LoadBalancersClient object to access its operations. + */ + private final LoadBalancersClient loadBalancers; + + /** + * Gets the LoadBalancersClient object to access its operations. + * + * @return the LoadBalancersClient object. + */ + public LoadBalancersClient getLoadBalancers() { + return this.loadBalancers; + } + + /** + * The ServicesClient object to access its operations. + */ + private final ServicesClient services; + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + public ServicesClient getServices() { + return this.services; + } + + /** + * The StorageClassClient object to access its operations. + */ + private final StorageClassClient storageClass; + + /** + * Gets the StorageClassClient object to access its operations. + * + * @return the StorageClassClient object. + */ + public StorageClassClient getStorageClass() { + return this.storageClass; + } + + /** + * 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; + } + + /** + * Initializes an instance of MicrosoftKubernetesRuntime 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 endpoint server parameter. + */ + MicrosoftKubernetesRuntimeImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2024-03-01"; + this.bgpPeers = new BgpPeersClientImpl(this); + this.loadBalancers = new LoadBalancersClientImpl(this); + this.services = new ServicesClientImpl(this); + this.storageClass = new StorageClassClientImpl(this); + this.operations = new OperationsClientImpl(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(HttpHeaderName.fromString(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(MicrosoftKubernetesRuntimeImpl.class); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationImpl.java new file mode 100644 index 000000000000..9c76fb73aa35 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.implementation; + +import com.azure.resourcemanager.kubernetesruntime.fluent.models.OperationInner; +import com.azure.resourcemanager.kubernetesruntime.models.ActionType; +import com.azure.resourcemanager.kubernetesruntime.models.Operation; +import com.azure.resourcemanager.kubernetesruntime.models.OperationDisplay; +import com.azure.resourcemanager.kubernetesruntime.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager 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.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationsClientImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..fc832475d094 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationsClientImpl.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.kubernetesruntime.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.kubernetesruntime.fluent.OperationsClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.OperationInner; +import com.azure.resourcemanager.kubernetesruntime.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 MicrosoftKubernetesRuntimeImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftKubernetesRuntimeImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftKubernetesRuntimeOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftKubernetesR") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.KubernetesRuntime/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); + } + + /** + * List the operations for the provider. + * + * @throws 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())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } + + /** + * List the operations for the provider. + * + * @throws 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)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } + + /** + * List the operations for the provider. + * + * @throws 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()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationsImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/OperationsImpl.java new file mode 100644 index 000000000000..e6de366b378a --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/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.kubernetesruntime.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.kubernetesruntime.fluent.OperationsClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.OperationInner; +import com.azure.resourcemanager.kubernetesruntime.models.Operation; +import com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.KubernetesruntimeManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ResourceManagerUtils.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..ab413d3ebd3b --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServiceResourceImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServiceResourceImpl.java new file mode 100644 index 000000000000..752834f49b45 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServiceResourceImpl.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.kubernetesruntime.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesruntime.models.ServiceResource; + +public final class ServiceResourceImpl implements ServiceResource, ServiceResource.Definition, ServiceResource.Update { + private ServiceResourceInner innerObject; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager 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 rpObjectId() { + return this.innerModel().rpObjectId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ServiceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String serviceName; + + public ServiceResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public ServiceResource create() { + this.innerObject = serviceManager.serviceClient() + .getServices() + .createOrUpdateWithResponse(resourceUri, serviceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServices() + .createOrUpdateWithResponse(resourceUri, serviceName, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceResourceImpl(String name, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = new ServiceResourceInner(); + this.serviceManager = serviceManager; + this.serviceName = name; + } + + public ServiceResourceImpl update() { + return this; + } + + public ServiceResource apply() { + this.innerObject = serviceManager.serviceClient() + .getServices() + .createOrUpdateWithResponse(resourceUri, serviceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServices() + .createOrUpdateWithResponse(resourceUri, serviceName, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceResourceImpl(ServiceResourceInner innerObject, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "resourceUri"); + this.serviceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "serviceName"); + } + + public ServiceResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getServices() + .getWithResponse(resourceUri, serviceName, Context.NONE) + .getValue(); + return this; + } + + public ServiceResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServices() + .getWithResponse(resourceUri, serviceName, context) + .getValue(); + return this; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServicesClientImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServicesClientImpl.java new file mode 100644 index 000000000000..7b8b1f367d09 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServicesClientImpl.java @@ -0,0 +1,614 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.kubernetesruntime.fluent.ServicesClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.ServiceResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ServicesClient. + */ +public final class ServicesClientImpl implements ServicesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ServicesService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftKubernetesRuntimeImpl client; + + /** + * Initializes an instance of ServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServicesClientImpl(MicrosoftKubernetesRuntimeImpl client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftKubernetesRuntimeServices to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftKubernetesR") + public interface ServicesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/services") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("serviceName") String serviceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("serviceName") String serviceName, @BodyParam("application/json") ServiceResourceInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("serviceName") String serviceName, @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); + } + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + 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 ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri 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(), resourceUri, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ServiceResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + serviceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ServiceResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String serviceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName 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(), resourceUri, serviceName, accept, + context); + } + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ServiceResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String serviceName) { + return getWithResponseAsync(resourceUri, serviceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ServiceResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String serviceName, Context context) { + return getWithResponseAsync(resourceUri, serviceName, context).block(); + } + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ServiceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner get(String resourceUri, String serviceName) { + return getWithResponse(resourceUri, serviceName, Context.NONE).getValue(); + } + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceUri, String serviceName, + ServiceResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, serviceName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceUri, String serviceName, + ServiceResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, serviceName, + resource, accept, context); + } + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String serviceName, + ServiceResourceInner resource) { + return createOrUpdateWithResponseAsync(resourceUri, serviceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceUri, String serviceName, + ServiceResourceInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceUri, serviceName, resource, context).block(); + } + + /** + * Create a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Service resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner createOrUpdate(String resourceUri, String serviceName, ServiceResourceInner resource) { + return createOrUpdateWithResponse(resourceUri, serviceName, resource, Context.NONE).getValue(); + } + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + serviceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String serviceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName 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(), resourceUri, serviceName, accept, + context); + } + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resourceUri, String serviceName) { + return deleteWithResponseAsync(resourceUri, serviceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String serviceName, Context context) { + return deleteWithResponseAsync(resourceUri, serviceName, context).block(); + } + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourceUri, String serviceName) { + deleteWithResponse(resourceUri, serviceName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServicesImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServicesImpl.java new file mode 100644 index 000000000000..b82b012aa382 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/ServicesImpl.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.kubernetesruntime.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.kubernetesruntime.fluent.ServicesClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.ServiceResource; +import com.azure.resourcemanager.kubernetesruntime.models.Services; + +public final class ServicesImpl implements Services { + private static final ClientLogger LOGGER = new ClientLogger(ServicesImpl.class); + + private final ServicesClient innerClient; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager; + + public ServicesImpl(ServicesClient innerClient, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceUri, String serviceName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, serviceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServiceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServiceResource get(String resourceUri, String serviceName) { + ServiceResourceInner inner = this.serviceClient().get(resourceUri, serviceName); + if (inner != null) { + return new ServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceUri, String serviceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, serviceName, context); + } + + public void deleteByResourceGroup(String resourceUri, String serviceName) { + this.serviceClient().delete(resourceUri, serviceName); + } + + public ServiceResource getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "serviceName"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceUri, serviceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "serviceName"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceUri, serviceName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "serviceName"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceUri, serviceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/services/{serviceName}", "serviceName"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceUri, serviceName, context); + } + + private ServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + public ServiceResourceImpl define(String name) { + return new ServiceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassClientImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassClientImpl.java new file mode 100644 index 000000000000..22fc4d5df94d --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassClientImpl.java @@ -0,0 +1,1064 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.StorageClassClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.StorageClassResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResourceListResult; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResourceUpdate; +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 StorageClassClient. + */ +public final class StorageClassClientImpl implements StorageClassClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageClassService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftKubernetesRuntimeImpl client; + + /** + * Initializes an instance of StorageClassClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageClassClientImpl(MicrosoftKubernetesRuntimeImpl client) { + this.service + = RestProxy.create(StorageClassService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftKubernetesRuntimeStorageClass to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftKubernetesR") + public interface StorageClassService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("storageClassName") String storageClassName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("storageClassName") String storageClassName, + @BodyParam("application/json") StorageClassResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("storageClassName") String storageClassName, + @BodyParam("application/json") StorageClassResourceUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("storageClassName") String storageClassName, @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); + } + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + 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 StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri 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(), resourceUri, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClassResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, + String storageClassName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + storageClassName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClassResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String storageClassName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName 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(), resourceUri, storageClassName, + accept, context); + } + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClassResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String storageClassName) { + return getWithResponseAsync(resourceUri, storageClassName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClassResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String storageClassName, + Context context) { + return getWithResponseAsync(resourceUri, storageClassName, context).block(); + } + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClassResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageClassResourceInner get(String resourceUri, String storageClassName) { + return getWithResponse(resourceUri, storageClassName, Context.NONE).getValue(); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, + String storageClassName, StorageClassResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, storageClassName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, + String storageClassName, StorageClassResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + storageClassName, resource, accept, context); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageClassResourceInner> + beginCreateOrUpdateAsync(String resourceUri, String storageClassName, StorageClassResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, storageClassName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageClassResourceInner.class, StorageClassResourceInner.class, + this.client.getContext()); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageClassResourceInner> beginCreateOrUpdateAsync( + String resourceUri, String storageClassName, StorageClassResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, storageClassName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageClassResourceInner.class, StorageClassResourceInner.class, context); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageClassResourceInner> + beginCreateOrUpdate(String resourceUri, String storageClassName, StorageClassResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceUri, storageClassName, resource).getSyncPoller(); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageClassResourceInner> beginCreateOrUpdate( + String resourceUri, String storageClassName, StorageClassResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceUri, storageClassName, resource, context).getSyncPoller(); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String storageClassName, + StorageClassResourceInner resource) { + return beginCreateOrUpdateAsync(resourceUri, storageClassName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String storageClassName, + StorageClassResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceUri, storageClassName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageClassResourceInner createOrUpdate(String resourceUri, String storageClassName, + StorageClassResourceInner resource) { + return createOrUpdateAsync(resourceUri, storageClassName, resource).block(); + } + + /** + * Create a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageClassResourceInner createOrUpdate(String resourceUri, String storageClassName, + StorageClassResourceInner resource, Context context) { + return createOrUpdateAsync(resourceUri, storageClassName, resource, context).block(); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + storageClassName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, storageClassName, + properties, accept, context); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageClassResourceInner> + beginUpdateAsync(String resourceUri, String storageClassName, StorageClassResourceUpdate properties) { + Mono>> mono = updateWithResponseAsync(resourceUri, storageClassName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageClassResourceInner.class, StorageClassResourceInner.class, + this.client.getContext()); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageClassResourceInner> beginUpdateAsync( + String resourceUri, String storageClassName, StorageClassResourceUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceUri, storageClassName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageClassResourceInner.class, StorageClassResourceInner.class, context); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageClassResourceInner> beginUpdate(String resourceUri, + String storageClassName, StorageClassResourceUpdate properties) { + return this.beginUpdateAsync(resourceUri, storageClassName, properties).getSyncPoller(); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 StorageClass resource for an Arc connected cluster + * (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageClassResourceInner> beginUpdate(String resourceUri, + String storageClassName, StorageClassResourceUpdate properties, Context context) { + return this.beginUpdateAsync(resourceUri, storageClassName, properties, context).getSyncPoller(); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties) { + return beginUpdateAsync(resourceUri, storageClassName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters) on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties, Context context) { + return beginUpdateAsync(resourceUri, storageClassName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageClassResourceInner update(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties) { + return updateAsync(resourceUri, storageClassName, properties).block(); + } + + /** + * Update a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 StorageClass resource for an Arc connected cluster (Microsoft.Kubernetes/connectedClusters). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageClassResourceInner update(String resourceUri, String storageClassName, + StorageClassResourceUpdate properties, Context context) { + return updateAsync(resourceUri, storageClassName, properties, context).block(); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String storageClassName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + storageClassName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String storageClassName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (storageClassName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageClassName 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(), resourceUri, storageClassName, + accept, context); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String storageClassName) { + Mono>> mono = deleteWithResponseAsync(resourceUri, storageClassName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String storageClassName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceUri, storageClassName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String storageClassName) { + return this.beginDeleteAsync(resourceUri, storageClassName).getSyncPoller(); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceUri, String storageClassName, + Context context) { + return this.beginDeleteAsync(resourceUri, storageClassName, context).getSyncPoller(); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resourceUri, String storageClassName) { + return beginDeleteAsync(resourceUri, storageClassName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 resourceUri, String storageClassName, Context context) { + return beginDeleteAsync(resourceUri, storageClassName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourceUri, String storageClassName) { + deleteAsync(resourceUri, storageClassName).block(); + } + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourceUri, String storageClassName, Context context) { + deleteAsync(resourceUri, storageClassName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource 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 URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassImpl.java new file mode 100644 index 000000000000..02798fa27feb --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.StorageClassClient; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.StorageClassResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClass; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResource; + +public final class StorageClassImpl implements StorageClass { + private static final ClientLogger LOGGER = new ClientLogger(StorageClassImpl.class); + + private final StorageClassClient innerClient; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager; + + public StorageClassImpl(StorageClassClient innerClient, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageClassResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageClassResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceUri, String storageClassName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, storageClassName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageClassResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StorageClassResource get(String resourceUri, String storageClassName) { + StorageClassResourceInner inner = this.serviceClient().get(resourceUri, storageClassName); + if (inner != null) { + return new StorageClassResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceUri, String storageClassName) { + this.serviceClient().delete(resourceUri, storageClassName); + } + + public void delete(String resourceUri, String storageClassName, Context context) { + this.serviceClient().delete(resourceUri, storageClassName, context); + } + + public StorageClassResource getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String storageClassName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", + "storageClassName"); + if (storageClassName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageClasses'.", id))); + } + return this.getWithResponse(resourceUri, storageClassName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String storageClassName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", + "storageClassName"); + if (storageClassName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageClasses'.", id))); + } + return this.getWithResponse(resourceUri, storageClassName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String storageClassName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", + "storageClassName"); + if (storageClassName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageClasses'.", id))); + } + this.delete(resourceUri, storageClassName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String storageClassName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", + "storageClassName"); + if (storageClassName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageClasses'.", id))); + } + this.delete(resourceUri, storageClassName, context); + } + + private StorageClassClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + public StorageClassResourceImpl define(String name) { + return new StorageClassResourceImpl(name, this.manager()); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassResourceImpl.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassResourceImpl.java new file mode 100644 index 000000000000..3c97e794df07 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/StorageClassResourceImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.StorageClassResourceInner; +import com.azure.resourcemanager.kubernetesruntime.models.AccessMode; +import com.azure.resourcemanager.kubernetesruntime.models.DataResilienceTier; +import com.azure.resourcemanager.kubernetesruntime.models.FailoverTier; +import com.azure.resourcemanager.kubernetesruntime.models.PerformanceTier; +import com.azure.resourcemanager.kubernetesruntime.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassPropertiesUpdate; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResource; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResourceUpdate; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassTypeProperties; +import com.azure.resourcemanager.kubernetesruntime.models.VolumeBindingMode; +import com.azure.resourcemanager.kubernetesruntime.models.VolumeExpansion; +import java.util.Collections; +import java.util.List; + +public final class StorageClassResourceImpl + implements StorageClassResource, StorageClassResource.Definition, StorageClassResource.Update { + private StorageClassResourceInner innerObject; + + private final com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager 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 VolumeExpansion allowVolumeExpansion() { + return this.innerModel().allowVolumeExpansion(); + } + + public List mountOptions() { + List inner = this.innerModel().mountOptions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioner() { + return this.innerModel().provisioner(); + } + + public VolumeBindingMode volumeBindingMode() { + return this.innerModel().volumeBindingMode(); + } + + public List accessModes() { + List inner = this.innerModel().accessModes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DataResilienceTier dataResilience() { + return this.innerModel().dataResilience(); + } + + public FailoverTier failoverSpeed() { + return this.innerModel().failoverSpeed(); + } + + public List limitations() { + List inner = this.innerModel().limitations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PerformanceTier performance() { + return this.innerModel().performance(); + } + + public Long priority() { + return this.innerModel().priority(); + } + + public StorageClassTypeProperties typeProperties() { + return this.innerModel().typeProperties(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public StorageClassResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String storageClassName; + + private StorageClassResourceUpdate updateProperties; + + public StorageClassResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public StorageClassResource create() { + this.innerObject = serviceManager.serviceClient() + .getStorageClass() + .createOrUpdate(resourceUri, storageClassName, this.innerModel(), Context.NONE); + return this; + } + + public StorageClassResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageClass() + .createOrUpdate(resourceUri, storageClassName, this.innerModel(), context); + return this; + } + + StorageClassResourceImpl(String name, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = new StorageClassResourceInner(); + this.serviceManager = serviceManager; + this.storageClassName = name; + } + + public StorageClassResourceImpl update() { + this.updateProperties = new StorageClassResourceUpdate(); + return this; + } + + public StorageClassResource apply() { + this.innerObject = serviceManager.serviceClient() + .getStorageClass() + .update(resourceUri, storageClassName, updateProperties, Context.NONE); + return this; + } + + public StorageClassResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageClass() + .update(resourceUri, storageClassName, updateProperties, context); + return this; + } + + StorageClassResourceImpl(StorageClassResourceInner innerObject, + com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", "resourceUri"); + this.storageClassName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.KubernetesRuntime/storageClasses/{storageClassName}", + "storageClassName"); + } + + public StorageClassResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getStorageClass() + .getWithResponse(resourceUri, storageClassName, Context.NONE) + .getValue(); + return this; + } + + public StorageClassResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageClass() + .getWithResponse(resourceUri, storageClassName, context) + .getValue(); + return this; + } + + public StorageClassResourceImpl withAllowVolumeExpansion(VolumeExpansion allowVolumeExpansion) { + this.innerModel().withAllowVolumeExpansion(allowVolumeExpansion); + return this; + } + + public StorageClassResourceImpl withMountOptions(List mountOptions) { + this.innerModel().withMountOptions(mountOptions); + return this; + } + + public StorageClassResourceImpl withProvisioner(String provisioner) { + this.innerModel().withProvisioner(provisioner); + return this; + } + + public StorageClassResourceImpl withVolumeBindingMode(VolumeBindingMode volumeBindingMode) { + this.innerModel().withVolumeBindingMode(volumeBindingMode); + return this; + } + + public StorageClassResourceImpl withAccessModes(List accessModes) { + this.innerModel().withAccessModes(accessModes); + return this; + } + + public StorageClassResourceImpl withDataResilience(DataResilienceTier dataResilience) { + this.innerModel().withDataResilience(dataResilience); + return this; + } + + public StorageClassResourceImpl withFailoverSpeed(FailoverTier failoverSpeed) { + this.innerModel().withFailoverSpeed(failoverSpeed); + return this; + } + + public StorageClassResourceImpl withLimitations(List limitations) { + this.innerModel().withLimitations(limitations); + return this; + } + + public StorageClassResourceImpl withPerformance(PerformanceTier performance) { + this.innerModel().withPerformance(performance); + return this; + } + + public StorageClassResourceImpl withPriority(Long priority) { + this.innerModel().withPriority(priority); + return this; + } + + public StorageClassResourceImpl withTypeProperties(StorageClassTypeProperties typeProperties) { + this.innerModel().withTypeProperties(typeProperties); + return this; + } + + public StorageClassResourceImpl withProperties(StorageClassPropertiesUpdate properties) { + this.updateProperties.withProperties(properties); + return this; + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/package-info.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/package-info.java new file mode 100644 index 000000000000..a357cee1ccd5 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftKubernetesRuntime. + * null. + */ +package com.azure.resourcemanager.kubernetesruntime.implementation; diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/AccessMode.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/AccessMode.java new file mode 100644 index 000000000000..e25f5b4ccd50 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/AccessMode.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Storage Class Access Mode. + */ +public final class AccessMode extends ExpandableStringEnum { + /** + * Static value ReadWriteOnce for AccessMode. + */ + public static final AccessMode READ_WRITE_ONCE = fromString("ReadWriteOnce"); + + /** + * Static value ReadWriteMany for AccessMode. + */ + public static final AccessMode READ_WRITE_MANY = fromString("ReadWriteMany"); + + /** + * Creates a new instance of AccessMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccessMode() { + } + + /** + * Creates or finds a AccessMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessMode. + */ + public static AccessMode fromString(String name) { + return fromString(name, AccessMode.class); + } + + /** + * Gets known AccessMode values. + * + * @return known AccessMode values. + */ + public static Collection values() { + return values(AccessMode.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ActionType.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ActionType.java new file mode 100644 index 000000000000..03bb41a37897 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/AdvertiseMode.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/AdvertiseMode.java new file mode 100644 index 000000000000..a014eaf37701 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/AdvertiseMode.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum of advertise mode. + */ +public final class AdvertiseMode extends ExpandableStringEnum { + /** + * Static value ARP for AdvertiseMode. + */ + public static final AdvertiseMode ARP = fromString("ARP"); + + /** + * Static value BGP for AdvertiseMode. + */ + public static final AdvertiseMode BGP = fromString("BGP"); + + /** + * Static value Both for AdvertiseMode. + */ + public static final AdvertiseMode BOTH = fromString("Both"); + + /** + * Creates a new instance of AdvertiseMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AdvertiseMode() { + } + + /** + * Creates or finds a AdvertiseMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdvertiseMode. + */ + public static AdvertiseMode fromString(String name) { + return fromString(name, AdvertiseMode.class); + } + + /** + * Gets known AdvertiseMode values. + * + * @return known AdvertiseMode values. + */ + public static Collection values() { + return values(AdvertiseMode.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeer.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeer.java new file mode 100644 index 000000000000..2ff4cd8fc91c --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeer.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.BgpPeerInner; + +/** + * An immutable client-side representation of BgpPeer. + */ +public interface BgpPeer { + /** + * 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 myAsn property: My ASN. + * + * @return the myAsn value. + */ + int myAsn(); + + /** + * Gets the peerAsn property: Peer ASN. + * + * @return the peerAsn value. + */ + int peerAsn(); + + /** + * Gets the peerAddress property: Peer Address. + * + * @return the peerAddress value. + */ + String peerAddress(); + + /** + * Gets the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.kubernetesruntime.fluent.models.BgpPeerInner object. + * + * @return the inner object. + */ + BgpPeerInner innerModel(); + + /** + * The entirety of the BgpPeer definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The BgpPeer definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the BgpPeer definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the BgpPeer definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the BgpPeer 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.WithMyAsn, DefinitionStages.WithPeerAsn, DefinitionStages.WithPeerAddress { + /** + * Executes the create request. + * + * @return the created resource. + */ + BgpPeer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BgpPeer create(Context context); + } + + /** + * The stage of the BgpPeer definition allowing to specify myAsn. + */ + interface WithMyAsn { + /** + * Specifies the myAsn property: My ASN. + * + * @param myAsn My ASN. + * @return the next definition stage. + */ + WithCreate withMyAsn(int myAsn); + } + + /** + * The stage of the BgpPeer definition allowing to specify peerAsn. + */ + interface WithPeerAsn { + /** + * Specifies the peerAsn property: Peer ASN. + * + * @param peerAsn Peer ASN. + * @return the next definition stage. + */ + WithCreate withPeerAsn(int peerAsn); + } + + /** + * The stage of the BgpPeer definition allowing to specify peerAddress. + */ + interface WithPeerAddress { + /** + * Specifies the peerAddress property: Peer Address. + * + * @param peerAddress Peer Address. + * @return the next definition stage. + */ + WithCreate withPeerAddress(String peerAddress); + } + } + + /** + * Begins update for the BgpPeer resource. + * + * @return the stage of resource update. + */ + BgpPeer.Update update(); + + /** + * The template for BgpPeer update. + */ + interface Update extends UpdateStages.WithMyAsn, UpdateStages.WithPeerAsn, UpdateStages.WithPeerAddress { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BgpPeer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BgpPeer apply(Context context); + } + + /** + * The BgpPeer update stages. + */ + interface UpdateStages { + /** + * The stage of the BgpPeer update allowing to specify myAsn. + */ + interface WithMyAsn { + /** + * Specifies the myAsn property: My ASN. + * + * @param myAsn My ASN. + * @return the next definition stage. + */ + Update withMyAsn(int myAsn); + } + + /** + * The stage of the BgpPeer update allowing to specify peerAsn. + */ + interface WithPeerAsn { + /** + * Specifies the peerAsn property: Peer ASN. + * + * @param peerAsn Peer ASN. + * @return the next definition stage. + */ + Update withPeerAsn(int peerAsn); + } + + /** + * The stage of the BgpPeer update allowing to specify peerAddress. + */ + interface WithPeerAddress { + /** + * Specifies the peerAddress property: Peer Address. + * + * @param peerAddress Peer Address. + * @return the next definition stage. + */ + Update withPeerAddress(String peerAddress); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BgpPeer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BgpPeer refresh(Context context); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeerListResult.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeerListResult.java new file mode 100644 index 000000000000..df4c0f75fe5b --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeerListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.BgpPeerInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a BgpPeer list operation. + */ +@Fluent +public final class BgpPeerListResult implements JsonSerializable { + /* + * The BgpPeer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of BgpPeerListResult class. + */ + public BgpPeerListResult() { + } + + /** + * Get the value property: The BgpPeer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The BgpPeer items on this page. + * + * @param value the value value to set. + * @return the BgpPeerListResult object itself. + */ + public BgpPeerListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the BgpPeerListResult object itself. + */ + public BgpPeerListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model BgpPeerListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BgpPeerListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BgpPeerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BgpPeerListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BgpPeerListResult. + */ + public static BgpPeerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BgpPeerListResult deserializedBgpPeerListResult = new BgpPeerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> BgpPeerInner.fromJson(reader1)); + deserializedBgpPeerListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBgpPeerListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBgpPeerListResult; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeers.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeers.java new file mode 100644 index 000000000000..f9c021cb76f1 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BgpPeers.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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 BgpPeers. + */ +public interface BgpPeers { + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * List BgpPeer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BgpPeer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @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 BgpPeer along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String bgpPeerName, Context context); + + /** + * Get a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 BgpPeer. + */ + BgpPeer get(String resourceUri, String bgpPeerName); + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @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 deleteByResourceGroupWithResponse(String resourceUri, String bgpPeerName, Context context); + + /** + * Delete a BgpPeer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param bgpPeerName The name of the BgpPeer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String bgpPeerName); + + /** + * Get a BgpPeer. + * + * @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 BgpPeer along with {@link Response}. + */ + BgpPeer getById(String id); + + /** + * Get a BgpPeer. + * + * @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 BgpPeer along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a BgpPeer. + * + * @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); + + /** + * Delete a BgpPeer. + * + * @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 BgpPeer resource. + * + * @param name resource name. + * @return the first stage of the new BgpPeer definition. + */ + BgpPeer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BlobStorageClassTypeProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BlobStorageClassTypeProperties.java new file mode 100644 index 000000000000..e44efb751039 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/BlobStorageClassTypeProperties.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.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Blob StorageClass. + */ +@Fluent +public final class BlobStorageClassTypeProperties extends StorageClassTypeProperties { + /* + * Type of the storage class. + */ + private SCType type = SCType.BLOB; + + /* + * Azure Storage Account Name + */ + private String azureStorageAccountName; + + /* + * Azure Storage Account Key + */ + private String azureStorageAccountKey; + + /** + * Creates an instance of BlobStorageClassTypeProperties class. + */ + public BlobStorageClassTypeProperties() { + } + + /** + * Get the type property: Type of the storage class. + * + * @return the type value. + */ + @Override + public SCType type() { + return this.type; + } + + /** + * Get the azureStorageAccountName property: Azure Storage Account Name. + * + * @return the azureStorageAccountName value. + */ + public String azureStorageAccountName() { + return this.azureStorageAccountName; + } + + /** + * Set the azureStorageAccountName property: Azure Storage Account Name. + * + * @param azureStorageAccountName the azureStorageAccountName value to set. + * @return the BlobStorageClassTypeProperties object itself. + */ + public BlobStorageClassTypeProperties withAzureStorageAccountName(String azureStorageAccountName) { + this.azureStorageAccountName = azureStorageAccountName; + return this; + } + + /** + * Get the azureStorageAccountKey property: Azure Storage Account Key. + * + * @return the azureStorageAccountKey value. + */ + public String azureStorageAccountKey() { + return this.azureStorageAccountKey; + } + + /** + * Set the azureStorageAccountKey property: Azure Storage Account Key. + * + * @param azureStorageAccountKey the azureStorageAccountKey value to set. + * @return the BlobStorageClassTypeProperties object itself. + */ + public BlobStorageClassTypeProperties withAzureStorageAccountKey(String azureStorageAccountKey) { + this.azureStorageAccountKey = azureStorageAccountKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azureStorageAccountName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureStorageAccountName in model BlobStorageClassTypeProperties")); + } + if (azureStorageAccountKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureStorageAccountKey in model BlobStorageClassTypeProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BlobStorageClassTypeProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureStorageAccountName", this.azureStorageAccountName); + jsonWriter.writeStringField("azureStorageAccountKey", this.azureStorageAccountKey); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BlobStorageClassTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BlobStorageClassTypeProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BlobStorageClassTypeProperties. + */ + public static BlobStorageClassTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BlobStorageClassTypeProperties deserializedBlobStorageClassTypeProperties + = new BlobStorageClassTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureStorageAccountName".equals(fieldName)) { + deserializedBlobStorageClassTypeProperties.azureStorageAccountName = reader.getString(); + } else if ("azureStorageAccountKey".equals(fieldName)) { + deserializedBlobStorageClassTypeProperties.azureStorageAccountKey = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBlobStorageClassTypeProperties.type = SCType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBlobStorageClassTypeProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/DataResilienceTier.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/DataResilienceTier.java new file mode 100644 index 000000000000..31e50a34cf2e --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/DataResilienceTier.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Data resilience tier of a storage class. + */ +public final class DataResilienceTier extends ExpandableStringEnum { + /** + * Static value NotDataResilient for DataResilienceTier. + */ + public static final DataResilienceTier NOT_DATA_RESILIENT = fromString("NotDataResilient"); + + /** + * Static value DataResilient for DataResilienceTier. + */ + public static final DataResilienceTier DATA_RESILIENT = fromString("DataResilient"); + + /** + * Creates a new instance of DataResilienceTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataResilienceTier() { + } + + /** + * Creates or finds a DataResilienceTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataResilienceTier. + */ + public static DataResilienceTier fromString(String name) { + return fromString(name, DataResilienceTier.class); + } + + /** + * Gets known DataResilienceTier values. + * + * @return known DataResilienceTier values. + */ + public static Collection values() { + return values(DataResilienceTier.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/FailoverTier.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/FailoverTier.java new file mode 100644 index 000000000000..058fd7610c64 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/FailoverTier.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Failover tier of a storage class. + */ +public final class FailoverTier extends ExpandableStringEnum { + /** + * Static value NotAvailable for FailoverTier. + */ + public static final FailoverTier NOT_AVAILABLE = fromString("NotAvailable"); + + /** + * Static value Slow for FailoverTier. + */ + public static final FailoverTier SLOW = fromString("Slow"); + + /** + * Static value Fast for FailoverTier. + */ + public static final FailoverTier FAST = fromString("Fast"); + + /** + * Static value Super for FailoverTier. + */ + public static final FailoverTier SUPER = fromString("Super"); + + /** + * Creates a new instance of FailoverTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FailoverTier() { + } + + /** + * Creates or finds a FailoverTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding FailoverTier. + */ + public static FailoverTier fromString(String name) { + return fromString(name, FailoverTier.class); + } + + /** + * Gets known FailoverTier values. + * + * @return known FailoverTier values. + */ + public static Collection values() { + return values(FailoverTier.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancer.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancer.java new file mode 100644 index 000000000000..dfeb509399a5 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancer.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.LoadBalancerInner; +import java.util.List; +import java.util.Map; + +/** + * An immutable client-side representation of LoadBalancer. + */ +public interface LoadBalancer { + /** + * 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 addresses property: IP Range. + * + * @return the addresses value. + */ + List addresses(); + + /** + * Gets the serviceSelector property: A dynamic label mapping to select related services. For instance, if you want + * to create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * + * @return the serviceSelector value. + */ + Map serviceSelector(); + + /** + * Gets the advertiseMode property: Advertise Mode. + * + * @return the advertiseMode value. + */ + AdvertiseMode advertiseMode(); + + /** + * Gets the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * + * @return the bgpPeers value. + */ + List bgpPeers(); + + /** + * Gets the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.kubernetesruntime.fluent.models.LoadBalancerInner object. + * + * @return the inner object. + */ + LoadBalancerInner innerModel(); + + /** + * The entirety of the LoadBalancer definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The LoadBalancer definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the LoadBalancer definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the LoadBalancer definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the LoadBalancer 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.WithAddresses, DefinitionStages.WithServiceSelector, + DefinitionStages.WithAdvertiseMode, DefinitionStages.WithBgpPeers { + /** + * Executes the create request. + * + * @return the created resource. + */ + LoadBalancer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LoadBalancer create(Context context); + } + + /** + * The stage of the LoadBalancer definition allowing to specify addresses. + */ + interface WithAddresses { + /** + * Specifies the addresses property: IP Range. + * + * @param addresses IP Range. + * @return the next definition stage. + */ + WithCreate withAddresses(List addresses); + } + + /** + * The stage of the LoadBalancer definition allowing to specify serviceSelector. + */ + interface WithServiceSelector { + /** + * Specifies the serviceSelector property: A dynamic label mapping to select related services. For instance, + * if you want to create a load balancer only for services with label "a=b", then please specify {"a": "b"} + * in the field.. + * + * @param serviceSelector A dynamic label mapping to select related services. For instance, if you want to + * create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * @return the next definition stage. + */ + WithCreate withServiceSelector(Map serviceSelector); + } + + /** + * The stage of the LoadBalancer definition allowing to specify advertiseMode. + */ + interface WithAdvertiseMode { + /** + * Specifies the advertiseMode property: Advertise Mode. + * + * @param advertiseMode Advertise Mode. + * @return the next definition stage. + */ + WithCreate withAdvertiseMode(AdvertiseMode advertiseMode); + } + + /** + * The stage of the LoadBalancer definition allowing to specify bgpPeers. + */ + interface WithBgpPeers { + /** + * Specifies the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to + * advertise to all peers.. + * + * @param bgpPeers The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * @return the next definition stage. + */ + WithCreate withBgpPeers(List bgpPeers); + } + } + + /** + * Begins update for the LoadBalancer resource. + * + * @return the stage of resource update. + */ + LoadBalancer.Update update(); + + /** + * The template for LoadBalancer update. + */ + interface Update extends UpdateStages.WithAddresses, UpdateStages.WithServiceSelector, + UpdateStages.WithAdvertiseMode, UpdateStages.WithBgpPeers { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LoadBalancer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LoadBalancer apply(Context context); + } + + /** + * The LoadBalancer update stages. + */ + interface UpdateStages { + /** + * The stage of the LoadBalancer update allowing to specify addresses. + */ + interface WithAddresses { + /** + * Specifies the addresses property: IP Range. + * + * @param addresses IP Range. + * @return the next definition stage. + */ + Update withAddresses(List addresses); + } + + /** + * The stage of the LoadBalancer update allowing to specify serviceSelector. + */ + interface WithServiceSelector { + /** + * Specifies the serviceSelector property: A dynamic label mapping to select related services. For instance, + * if you want to create a load balancer only for services with label "a=b", then please specify {"a": "b"} + * in the field.. + * + * @param serviceSelector A dynamic label mapping to select related services. For instance, if you want to + * create a load balancer only for services with label "a=b", then please specify {"a": "b"} in the field. + * @return the next definition stage. + */ + Update withServiceSelector(Map serviceSelector); + } + + /** + * The stage of the LoadBalancer update allowing to specify advertiseMode. + */ + interface WithAdvertiseMode { + /** + * Specifies the advertiseMode property: Advertise Mode. + * + * @param advertiseMode Advertise Mode. + * @return the next definition stage. + */ + Update withAdvertiseMode(AdvertiseMode advertiseMode); + } + + /** + * The stage of the LoadBalancer update allowing to specify bgpPeers. + */ + interface WithBgpPeers { + /** + * Specifies the bgpPeers property: The list of BGP peers it should advertise to. Null or empty means to + * advertise to all peers.. + * + * @param bgpPeers The list of BGP peers it should advertise to. Null or empty means to advertise to all + * peers. + * @return the next definition stage. + */ + Update withBgpPeers(List bgpPeers); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LoadBalancer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LoadBalancer refresh(Context context); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancerListResult.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancerListResult.java new file mode 100644 index 000000000000..564259913ab8 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancerListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.LoadBalancerInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a LoadBalancer list operation. + */ +@Fluent +public final class LoadBalancerListResult implements JsonSerializable { + /* + * The LoadBalancer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of LoadBalancerListResult class. + */ + public LoadBalancerListResult() { + } + + /** + * Get the value property: The LoadBalancer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The LoadBalancer items on this page. + * + * @param value the value value to set. + * @return the LoadBalancerListResult object itself. + */ + public LoadBalancerListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the LoadBalancerListResult object itself. + */ + public LoadBalancerListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model LoadBalancerListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LoadBalancerListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadBalancerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadBalancerListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LoadBalancerListResult. + */ + public static LoadBalancerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadBalancerListResult deserializedLoadBalancerListResult = new LoadBalancerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> LoadBalancerInner.fromJson(reader1)); + deserializedLoadBalancerListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedLoadBalancerListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadBalancerListResult; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancers.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancers.java new file mode 100644 index 000000000000..45f252feda58 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/LoadBalancers.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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 LoadBalancers. + */ +public interface LoadBalancers { + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * List LoadBalancer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadBalancer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @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 LoadBalancer along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String loadBalancerName, Context context); + + /** + * Get a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 LoadBalancer. + */ + LoadBalancer get(String resourceUri, String loadBalancerName); + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @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 deleteByResourceGroupWithResponse(String resourceUri, String loadBalancerName, Context context); + + /** + * Delete a LoadBalancer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param loadBalancerName The name of the LoadBalancer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String loadBalancerName); + + /** + * Get a LoadBalancer. + * + * @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 LoadBalancer along with {@link Response}. + */ + LoadBalancer getById(String id); + + /** + * Get a LoadBalancer. + * + * @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 LoadBalancer along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a LoadBalancer. + * + * @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); + + /** + * Delete a LoadBalancer. + * + * @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 LoadBalancer resource. + * + * @param name resource name. + * @return the first stage of the new LoadBalancer definition. + */ + LoadBalancer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NativeStorageClassTypeProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NativeStorageClassTypeProperties.java new file mode 100644 index 000000000000..982a1299a75f --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NativeStorageClassTypeProperties.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.kubernetesruntime.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Native StorageClass. + */ +@Immutable +public final class NativeStorageClassTypeProperties extends StorageClassTypeProperties { + /* + * Type of the storage class. + */ + private SCType type = SCType.NATIVE; + + /** + * Creates an instance of NativeStorageClassTypeProperties class. + */ + public NativeStorageClassTypeProperties() { + } + + /** + * Get the type property: Type of the storage class. + * + * @return the type value. + */ + @Override + public SCType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NativeStorageClassTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NativeStorageClassTypeProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NativeStorageClassTypeProperties. + */ + public static NativeStorageClassTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NativeStorageClassTypeProperties deserializedNativeStorageClassTypeProperties + = new NativeStorageClassTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedNativeStorageClassTypeProperties.type = SCType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNativeStorageClassTypeProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NfsDirectoryActionOnVolumeDeletion.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NfsDirectoryActionOnVolumeDeletion.java new file mode 100644 index 000000000000..30c985ec6d99 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NfsDirectoryActionOnVolumeDeletion.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The action to take when a NFS volume is deleted. + */ +public final class NfsDirectoryActionOnVolumeDeletion extends ExpandableStringEnum { + /** + * Static value Delete for NfsDirectoryActionOnVolumeDeletion. + */ + public static final NfsDirectoryActionOnVolumeDeletion DELETE = fromString("Delete"); + + /** + * Static value Retain for NfsDirectoryActionOnVolumeDeletion. + */ + public static final NfsDirectoryActionOnVolumeDeletion RETAIN = fromString("Retain"); + + /** + * Creates a new instance of NfsDirectoryActionOnVolumeDeletion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NfsDirectoryActionOnVolumeDeletion() { + } + + /** + * Creates or finds a NfsDirectoryActionOnVolumeDeletion from its string representation. + * + * @param name a name to look for. + * @return the corresponding NfsDirectoryActionOnVolumeDeletion. + */ + public static NfsDirectoryActionOnVolumeDeletion fromString(String name) { + return fromString(name, NfsDirectoryActionOnVolumeDeletion.class); + } + + /** + * Gets known NfsDirectoryActionOnVolumeDeletion values. + * + * @return known NfsDirectoryActionOnVolumeDeletion values. + */ + public static Collection values() { + return values(NfsDirectoryActionOnVolumeDeletion.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NfsStorageClassTypeProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NfsStorageClassTypeProperties.java new file mode 100644 index 000000000000..65fe4d331fe4 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/NfsStorageClassTypeProperties.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of NFS StorageClass. + */ +@Fluent +public final class NfsStorageClassTypeProperties extends StorageClassTypeProperties { + /* + * Type of the storage class. + */ + private SCType type = SCType.NFS; + + /* + * NFS Server + */ + private String server; + + /* + * NFS share + */ + private String share; + + /* + * Sub directory under share. If the sub directory doesn't exist, driver will create it + */ + private String subDir; + + /* + * Mounted folder permissions. Default is 0. If set as non-zero, driver will perform `chmod` after mount + */ + private String mountPermissions; + + /* + * The action to take when a NFS volume is deleted. Default is Delete + */ + private NfsDirectoryActionOnVolumeDeletion onDelete; + + /** + * Creates an instance of NfsStorageClassTypeProperties class. + */ + public NfsStorageClassTypeProperties() { + } + + /** + * Get the type property: Type of the storage class. + * + * @return the type value. + */ + @Override + public SCType type() { + return this.type; + } + + /** + * Get the server property: NFS Server. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: NFS Server. + * + * @param server the server value to set. + * @return the NfsStorageClassTypeProperties object itself. + */ + public NfsStorageClassTypeProperties withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the share property: NFS share. + * + * @return the share value. + */ + public String share() { + return this.share; + } + + /** + * Set the share property: NFS share. + * + * @param share the share value to set. + * @return the NfsStorageClassTypeProperties object itself. + */ + public NfsStorageClassTypeProperties withShare(String share) { + this.share = share; + return this; + } + + /** + * Get the subDir property: Sub directory under share. If the sub directory doesn't exist, driver will create it. + * + * @return the subDir value. + */ + public String subDir() { + return this.subDir; + } + + /** + * Set the subDir property: Sub directory under share. If the sub directory doesn't exist, driver will create it. + * + * @param subDir the subDir value to set. + * @return the NfsStorageClassTypeProperties object itself. + */ + public NfsStorageClassTypeProperties withSubDir(String subDir) { + this.subDir = subDir; + return this; + } + + /** + * Get the mountPermissions property: Mounted folder permissions. Default is 0. If set as non-zero, driver will + * perform `chmod` after mount. + * + * @return the mountPermissions value. + */ + public String mountPermissions() { + return this.mountPermissions; + } + + /** + * Set the mountPermissions property: Mounted folder permissions. Default is 0. If set as non-zero, driver will + * perform `chmod` after mount. + * + * @param mountPermissions the mountPermissions value to set. + * @return the NfsStorageClassTypeProperties object itself. + */ + public NfsStorageClassTypeProperties withMountPermissions(String mountPermissions) { + this.mountPermissions = mountPermissions; + return this; + } + + /** + * Get the onDelete property: The action to take when a NFS volume is deleted. Default is Delete. + * + * @return the onDelete value. + */ + public NfsDirectoryActionOnVolumeDeletion onDelete() { + return this.onDelete; + } + + /** + * Set the onDelete property: The action to take when a NFS volume is deleted. Default is Delete. + * + * @param onDelete the onDelete value to set. + * @return the NfsStorageClassTypeProperties object itself. + */ + public NfsStorageClassTypeProperties withOnDelete(NfsDirectoryActionOnVolumeDeletion onDelete) { + this.onDelete = onDelete; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (server() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property server in model NfsStorageClassTypeProperties")); + } + if (share() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property share in model NfsStorageClassTypeProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NfsStorageClassTypeProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("server", this.server); + jsonWriter.writeStringField("share", this.share); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("subDir", this.subDir); + jsonWriter.writeStringField("mountPermissions", this.mountPermissions); + jsonWriter.writeStringField("onDelete", this.onDelete == null ? null : this.onDelete.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NfsStorageClassTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NfsStorageClassTypeProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NfsStorageClassTypeProperties. + */ + public static NfsStorageClassTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NfsStorageClassTypeProperties deserializedNfsStorageClassTypeProperties + = new NfsStorageClassTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("server".equals(fieldName)) { + deserializedNfsStorageClassTypeProperties.server = reader.getString(); + } else if ("share".equals(fieldName)) { + deserializedNfsStorageClassTypeProperties.share = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNfsStorageClassTypeProperties.type = SCType.fromString(reader.getString()); + } else if ("subDir".equals(fieldName)) { + deserializedNfsStorageClassTypeProperties.subDir = reader.getString(); + } else if ("mountPermissions".equals(fieldName)) { + deserializedNfsStorageClassTypeProperties.mountPermissions = reader.getString(); + } else if ("onDelete".equals(fieldName)) { + deserializedNfsStorageClassTypeProperties.onDelete + = NfsDirectoryActionOnVolumeDeletion.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNfsStorageClassTypeProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Operation.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Operation.java new file mode 100644 index 000000000000..c0144c7bc390 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Operation.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.kubernetesruntime.models; + +import com.azure.resourcemanager.kubernetesruntime.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.kubernetesruntime.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/OperationDisplay.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/OperationDisplay.java new file mode 100644 index 000000000000..d8d3d8f4a4f0 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/OperationListResult.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/OperationListResult.java new file mode 100644 index 000000000000..8e2f867116a9 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.OperationInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Operations.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Operations.java new file mode 100644 index 000000000000..dc86d329ae3a --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Operations.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.kubernetesruntime.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.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(); + + /** + * List the operations for the provider. + * + * @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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Origin.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Origin.java new file mode 100644 index 000000000000..fd67ba0b8b42 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +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 a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + 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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/PerformanceTier.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/PerformanceTier.java new file mode 100644 index 000000000000..7c0817713c8c --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/PerformanceTier.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Performance tier of a storage class. + */ +public final class PerformanceTier extends ExpandableStringEnum { + /** + * Static value Undefined for PerformanceTier. + */ + public static final PerformanceTier UNDEFINED = fromString("Undefined"); + + /** + * Static value Basic for PerformanceTier. + */ + public static final PerformanceTier BASIC = fromString("Basic"); + + /** + * Static value Standard for PerformanceTier. + */ + public static final PerformanceTier STANDARD = fromString("Standard"); + + /** + * Static value Premium for PerformanceTier. + */ + public static final PerformanceTier PREMIUM = fromString("Premium"); + + /** + * Static value Ultra for PerformanceTier. + */ + public static final PerformanceTier ULTRA = fromString("Ultra"); + + /** + * Creates a new instance of PerformanceTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PerformanceTier() { + } + + /** + * Creates or finds a PerformanceTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding PerformanceTier. + */ + public static PerformanceTier fromString(String name) { + return fromString(name, PerformanceTier.class); + } + + /** + * Gets known PerformanceTier values. + * + * @return known PerformanceTier values. + */ + public static Collection values() { + return values(PerformanceTier.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ProvisioningState.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ProvisioningState.java new file mode 100644 index 000000000000..416b8304cdd2 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/RwxStorageClassTypeProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/RwxStorageClassTypeProperties.java new file mode 100644 index 000000000000..fe753ec19884 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/RwxStorageClassTypeProperties.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.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of RWX StorageClass. + */ +@Fluent +public final class RwxStorageClassTypeProperties extends StorageClassTypeProperties { + /* + * Type of the storage class. + */ + private SCType type = SCType.RWX; + + /* + * The backing storageclass used to create new storageclass + */ + private String backingStorageClassName; + + /** + * Creates an instance of RwxStorageClassTypeProperties class. + */ + public RwxStorageClassTypeProperties() { + } + + /** + * Get the type property: Type of the storage class. + * + * @return the type value. + */ + @Override + public SCType type() { + return this.type; + } + + /** + * Get the backingStorageClassName property: The backing storageclass used to create new storageclass. + * + * @return the backingStorageClassName value. + */ + public String backingStorageClassName() { + return this.backingStorageClassName; + } + + /** + * Set the backingStorageClassName property: The backing storageclass used to create new storageclass. + * + * @param backingStorageClassName the backingStorageClassName value to set. + * @return the RwxStorageClassTypeProperties object itself. + */ + public RwxStorageClassTypeProperties withBackingStorageClassName(String backingStorageClassName) { + this.backingStorageClassName = backingStorageClassName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (backingStorageClassName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property backingStorageClassName in model RwxStorageClassTypeProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RwxStorageClassTypeProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backingStorageClassName", this.backingStorageClassName); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RwxStorageClassTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RwxStorageClassTypeProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RwxStorageClassTypeProperties. + */ + public static RwxStorageClassTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RwxStorageClassTypeProperties deserializedRwxStorageClassTypeProperties + = new RwxStorageClassTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backingStorageClassName".equals(fieldName)) { + deserializedRwxStorageClassTypeProperties.backingStorageClassName = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRwxStorageClassTypeProperties.type = SCType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRwxStorageClassTypeProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/SCType.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/SCType.java new file mode 100644 index 000000000000..e859e15e61e0 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/SCType.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of a storage class. + */ +public final class SCType extends ExpandableStringEnum { + /** + * Static value Native for SCType. + */ + public static final SCType NATIVE = fromString("Native"); + + /** + * Static value RWX for SCType. + */ + public static final SCType RWX = fromString("RWX"); + + /** + * Static value Blob for SCType. + */ + public static final SCType BLOB = fromString("Blob"); + + /** + * Static value NFS for SCType. + */ + public static final SCType NFS = fromString("NFS"); + + /** + * Static value SMB for SCType. + */ + public static final SCType SMB = fromString("SMB"); + + /** + * Creates a new instance of SCType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SCType() { + } + + /** + * Creates or finds a SCType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SCType. + */ + public static SCType fromString(String name) { + return fromString(name, SCType.class); + } + + /** + * Gets known SCType values. + * + * @return known SCType values. + */ + public static Collection values() { + return values(SCType.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ServiceResource.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ServiceResource.java new file mode 100644 index 000000000000..21830dc8bd22 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ServiceResource.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.ServiceResourceInner; + +/** + * An immutable client-side representation of ServiceResource. + */ +public interface ServiceResource { + /** + * 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 rpObjectId property: The object id of the service principal of the RP provisioned in the tenant. + * + * @return the rpObjectId value. + */ + String rpObjectId(); + + /** + * Gets the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.kubernetesruntime.fluent.models.ServiceResourceInner object. + * + * @return the inner object. + */ + ServiceResourceInner innerModel(); + + /** + * The entirety of the ServiceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The ServiceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ServiceResource definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the ServiceResource definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the ServiceResource 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceResource create(Context context); + } + } + + /** + * Begins update for the ServiceResource resource. + * + * @return the stage of resource update. + */ + ServiceResource.Update update(); + + /** + * The template for ServiceResource update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceResource apply(Context context); + } + + /** + * The ServiceResource update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceResource refresh(Context context); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ServiceResourceListResult.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ServiceResourceListResult.java new file mode 100644 index 000000000000..d7190169524c --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/ServiceResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.ServiceResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ServiceResource list operation. + */ +@Fluent +public final class ServiceResourceListResult implements JsonSerializable { + /* + * The ServiceResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ServiceResourceListResult class. + */ + public ServiceResourceListResult() { + } + + /** + * Get the value property: The ServiceResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The ServiceResource items on this page. + * + * @param value the value value to set. + * @return the ServiceResourceListResult object itself. + */ + public ServiceResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ServiceResourceListResult object itself. + */ + public ServiceResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model ServiceResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServiceResourceListResult. + */ + public static ServiceResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceResourceListResult deserializedServiceResourceListResult = new ServiceResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ServiceResourceInner.fromJson(reader1)); + deserializedServiceResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedServiceResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceResourceListResult; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Services.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Services.java new file mode 100644 index 000000000000..b9cc225439be --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/Services.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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 Services. + */ +public interface Services { + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * List ServiceResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ServiceResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @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 ServiceResource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String serviceName, Context context); + + /** + * Get a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ServiceResource. + */ + ServiceResource get(String resourceUri, String serviceName); + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @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 deleteByResourceGroupWithResponse(String resourceUri, String serviceName, Context context); + + /** + * Delete a ServiceResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param serviceName The name of the the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String serviceName); + + /** + * Get a ServiceResource. + * + * @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 ServiceResource along with {@link Response}. + */ + ServiceResource getById(String id); + + /** + * Get a ServiceResource. + * + * @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 ServiceResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ServiceResource. + * + * @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); + + /** + * Delete a ServiceResource. + * + * @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 ServiceResource resource. + * + * @param name resource name. + * @return the first stage of the new ServiceResource definition. + */ + ServiceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/SmbStorageClassTypeProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/SmbStorageClassTypeProperties.java new file mode 100644 index 000000000000..dbd22db2bce6 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/SmbStorageClassTypeProperties.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.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of SMB StorageClass. + */ +@Fluent +public final class SmbStorageClassTypeProperties extends StorageClassTypeProperties { + /* + * Type of the storage class. + */ + private SCType type = SCType.SMB; + + /* + * SMB Source + */ + private String source; + + /* + * Sub directory under share. If the sub directory doesn't exist, driver will create it + */ + private String subDir; + + /* + * Server username + */ + private String username; + + /* + * Server password + */ + private String password; + + /* + * Server domain + */ + private String domain; + + /** + * Creates an instance of SmbStorageClassTypeProperties class. + */ + public SmbStorageClassTypeProperties() { + } + + /** + * Get the type property: Type of the storage class. + * + * @return the type value. + */ + @Override + public SCType type() { + return this.type; + } + + /** + * Get the source property: SMB Source. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: SMB Source. + * + * @param source the source value to set. + * @return the SmbStorageClassTypeProperties object itself. + */ + public SmbStorageClassTypeProperties withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the subDir property: Sub directory under share. If the sub directory doesn't exist, driver will create it. + * + * @return the subDir value. + */ + public String subDir() { + return this.subDir; + } + + /** + * Set the subDir property: Sub directory under share. If the sub directory doesn't exist, driver will create it. + * + * @param subDir the subDir value to set. + * @return the SmbStorageClassTypeProperties object itself. + */ + public SmbStorageClassTypeProperties withSubDir(String subDir) { + this.subDir = subDir; + return this; + } + + /** + * Get the username property: Server username. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Server username. + * + * @param username the username value to set. + * @return the SmbStorageClassTypeProperties object itself. + */ + public SmbStorageClassTypeProperties withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Server password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Server password. + * + * @param password the password value to set. + * @return the SmbStorageClassTypeProperties object itself. + */ + public SmbStorageClassTypeProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the domain property: Server domain. + * + * @return the domain value. + */ + public String domain() { + return this.domain; + } + + /** + * Set the domain property: Server domain. + * + * @param domain the domain value to set. + * @return the SmbStorageClassTypeProperties object itself. + */ + public SmbStorageClassTypeProperties withDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (source() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property source in model SmbStorageClassTypeProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SmbStorageClassTypeProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("source", this.source); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("subDir", this.subDir); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("password", this.password); + jsonWriter.writeStringField("domain", this.domain); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SmbStorageClassTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SmbStorageClassTypeProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SmbStorageClassTypeProperties. + */ + public static SmbStorageClassTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SmbStorageClassTypeProperties deserializedSmbStorageClassTypeProperties + = new SmbStorageClassTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("source".equals(fieldName)) { + deserializedSmbStorageClassTypeProperties.source = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSmbStorageClassTypeProperties.type = SCType.fromString(reader.getString()); + } else if ("subDir".equals(fieldName)) { + deserializedSmbStorageClassTypeProperties.subDir = reader.getString(); + } else if ("username".equals(fieldName)) { + deserializedSmbStorageClassTypeProperties.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedSmbStorageClassTypeProperties.password = reader.getString(); + } else if ("domain".equals(fieldName)) { + deserializedSmbStorageClassTypeProperties.domain = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSmbStorageClassTypeProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClass.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClass.java new file mode 100644 index 000000000000..104460d511b9 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClass.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.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 StorageClass. + */ +public interface StorageClass { + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * List StorageClassResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageClassResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @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 StorageClassResource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String storageClassName, Context context); + + /** + * Get a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 StorageClassResource. + */ + StorageClassResource get(String resourceUri, String storageClassName); + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourceUri, String storageClassName); + + /** + * Delete a StorageClassResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param storageClassName The name of the the storage class. + * @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 resourceUri, String storageClassName, Context context); + + /** + * Get a StorageClassResource. + * + * @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 StorageClassResource along with {@link Response}. + */ + StorageClassResource getById(String id); + + /** + * Get a StorageClassResource. + * + * @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 StorageClassResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a StorageClassResource. + * + * @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); + + /** + * Delete a StorageClassResource. + * + * @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 StorageClassResource resource. + * + * @param name resource name. + * @return the first stage of the new StorageClassResource definition. + */ + StorageClassResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassPropertiesUpdate.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassPropertiesUpdate.java new file mode 100644 index 000000000000..c96bf92541f7 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassPropertiesUpdate.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The model for updating storageClass properties. + */ +@Fluent +public final class StorageClassPropertiesUpdate implements JsonSerializable { + /* + * Volume can be expanded or not + */ + private VolumeExpansion allowVolumeExpansion; + + /* + * Additional mount options + */ + private List mountOptions; + + /* + * The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce] + */ + private List accessModes; + + /* + * Allow single data node failure + */ + private DataResilienceTier dataResilience; + + /* + * Failover speed: NA, Slow, Fast + */ + private FailoverTier failoverSpeed; + + /* + * Limitations of the storage class + */ + private List limitations; + + /* + * Performance tier + */ + private PerformanceTier performance; + + /* + * Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: Never use + */ + private Long priority; + + /* + * New storage class type of storageClass + */ + private StorageClassTypePropertiesUpdate typeProperties; + + /** + * Creates an instance of StorageClassPropertiesUpdate class. + */ + public StorageClassPropertiesUpdate() { + } + + /** + * Get the allowVolumeExpansion property: Volume can be expanded or not. + * + * @return the allowVolumeExpansion value. + */ + public VolumeExpansion allowVolumeExpansion() { + return this.allowVolumeExpansion; + } + + /** + * Set the allowVolumeExpansion property: Volume can be expanded or not. + * + * @param allowVolumeExpansion the allowVolumeExpansion value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withAllowVolumeExpansion(VolumeExpansion allowVolumeExpansion) { + this.allowVolumeExpansion = allowVolumeExpansion; + return this; + } + + /** + * Get the mountOptions property: Additional mount options. + * + * @return the mountOptions value. + */ + public List mountOptions() { + return this.mountOptions; + } + + /** + * Set the mountOptions property: Additional mount options. + * + * @param mountOptions the mountOptions value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withMountOptions(List mountOptions) { + this.mountOptions = mountOptions; + return this; + } + + /** + * Get the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @return the accessModes value. + */ + public List accessModes() { + return this.accessModes; + } + + /** + * Set the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @param accessModes the accessModes value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withAccessModes(List accessModes) { + this.accessModes = accessModes; + return this; + } + + /** + * Get the dataResilience property: Allow single data node failure. + * + * @return the dataResilience value. + */ + public DataResilienceTier dataResilience() { + return this.dataResilience; + } + + /** + * Set the dataResilience property: Allow single data node failure. + * + * @param dataResilience the dataResilience value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withDataResilience(DataResilienceTier dataResilience) { + this.dataResilience = dataResilience; + return this; + } + + /** + * Get the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @return the failoverSpeed value. + */ + public FailoverTier failoverSpeed() { + return this.failoverSpeed; + } + + /** + * Set the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @param failoverSpeed the failoverSpeed value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withFailoverSpeed(FailoverTier failoverSpeed) { + this.failoverSpeed = failoverSpeed; + return this; + } + + /** + * Get the limitations property: Limitations of the storage class. + * + * @return the limitations value. + */ + public List limitations() { + return this.limitations; + } + + /** + * Set the limitations property: Limitations of the storage class. + * + * @param limitations the limitations value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withLimitations(List limitations) { + this.limitations = limitations; + return this; + } + + /** + * Get the performance property: Performance tier. + * + * @return the performance value. + */ + public PerformanceTier performance() { + return this.performance; + } + + /** + * Set the performance property: Performance tier. + * + * @param performance the performance value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withPerformance(PerformanceTier performance) { + this.performance = performance; + return this; + } + + /** + * Get the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @return the priority value. + */ + public Long priority() { + return this.priority; + } + + /** + * Set the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @param priority the priority value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withPriority(Long priority) { + this.priority = priority; + return this; + } + + /** + * Get the typeProperties property: New storage class type of storageClass. + * + * @return the typeProperties value. + */ + public StorageClassTypePropertiesUpdate typeProperties() { + return this.typeProperties; + } + + /** + * Set the typeProperties property: New storage class type of storageClass. + * + * @param typeProperties the typeProperties value to set. + * @return the StorageClassPropertiesUpdate object itself. + */ + public StorageClassPropertiesUpdate withTypeProperties(StorageClassTypePropertiesUpdate typeProperties) { + this.typeProperties = typeProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (typeProperties() != null) { + typeProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("allowVolumeExpansion", + this.allowVolumeExpansion == null ? null : this.allowVolumeExpansion.toString()); + jsonWriter.writeArrayField("mountOptions", this.mountOptions, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("accessModes", this.accessModes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("dataResilience", + this.dataResilience == null ? null : this.dataResilience.toString()); + jsonWriter.writeStringField("failoverSpeed", this.failoverSpeed == null ? null : this.failoverSpeed.toString()); + jsonWriter.writeArrayField("limitations", this.limitations, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("performance", this.performance == null ? null : this.performance.toString()); + jsonWriter.writeNumberField("priority", this.priority); + jsonWriter.writeJsonField("typeProperties", this.typeProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassPropertiesUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassPropertiesUpdate if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageClassPropertiesUpdate. + */ + public static StorageClassPropertiesUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassPropertiesUpdate deserializedStorageClassPropertiesUpdate = new StorageClassPropertiesUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("allowVolumeExpansion".equals(fieldName)) { + deserializedStorageClassPropertiesUpdate.allowVolumeExpansion + = VolumeExpansion.fromString(reader.getString()); + } else if ("mountOptions".equals(fieldName)) { + List mountOptions = reader.readArray(reader1 -> reader1.getString()); + deserializedStorageClassPropertiesUpdate.mountOptions = mountOptions; + } else if ("accessModes".equals(fieldName)) { + List accessModes + = reader.readArray(reader1 -> AccessMode.fromString(reader1.getString())); + deserializedStorageClassPropertiesUpdate.accessModes = accessModes; + } else if ("dataResilience".equals(fieldName)) { + deserializedStorageClassPropertiesUpdate.dataResilience + = DataResilienceTier.fromString(reader.getString()); + } else if ("failoverSpeed".equals(fieldName)) { + deserializedStorageClassPropertiesUpdate.failoverSpeed + = FailoverTier.fromString(reader.getString()); + } else if ("limitations".equals(fieldName)) { + List limitations = reader.readArray(reader1 -> reader1.getString()); + deserializedStorageClassPropertiesUpdate.limitations = limitations; + } else if ("performance".equals(fieldName)) { + deserializedStorageClassPropertiesUpdate.performance + = PerformanceTier.fromString(reader.getString()); + } else if ("priority".equals(fieldName)) { + deserializedStorageClassPropertiesUpdate.priority = reader.getNullable(JsonReader::getLong); + } else if ("typeProperties".equals(fieldName)) { + deserializedStorageClassPropertiesUpdate.typeProperties + = StorageClassTypePropertiesUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassPropertiesUpdate; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResource.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResource.java new file mode 100644 index 000000000000..e493c785775f --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResource.java @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.StorageClassResourceInner; +import java.util.List; + +/** + * An immutable client-side representation of StorageClassResource. + */ +public interface StorageClassResource { + /** + * 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 allowVolumeExpansion property: Volume can be expanded or not. + * + * @return the allowVolumeExpansion value. + */ + VolumeExpansion allowVolumeExpansion(); + + /** + * Gets the mountOptions property: Additional mount options. + * + * @return the mountOptions value. + */ + List mountOptions(); + + /** + * Gets the provisioner property: Provisioner name. + * + * @return the provisioner value. + */ + String provisioner(); + + /** + * Gets the volumeBindingMode property: Binding mode of volumes: Immediate, WaitForFirstConsumer. + * + * @return the volumeBindingMode value. + */ + VolumeBindingMode volumeBindingMode(); + + /** + * Gets the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @return the accessModes value. + */ + List accessModes(); + + /** + * Gets the dataResilience property: Allow single data node failure. + * + * @return the dataResilience value. + */ + DataResilienceTier dataResilience(); + + /** + * Gets the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @return the failoverSpeed value. + */ + FailoverTier failoverSpeed(); + + /** + * Gets the limitations property: Limitations of the storage class. + * + * @return the limitations value. + */ + List limitations(); + + /** + * Gets the performance property: Performance tier. + * + * @return the performance value. + */ + PerformanceTier performance(); + + /** + * Gets the priority property: Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: + * Never use. + * + * @return the priority value. + */ + Long priority(); + + /** + * Gets the typeProperties property: Properties of the StorageClass. + * + * @return the typeProperties value. + */ + StorageClassTypeProperties typeProperties(); + + /** + * Gets the provisioningState property: Resource provision state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.kubernetesruntime.fluent.models.StorageClassResourceInner object. + * + * @return the inner object. + */ + StorageClassResourceInner innerModel(); + + /** + * The entirety of the StorageClassResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The StorageClassResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the StorageClassResource definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the StorageClassResource definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the StorageClassResource 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.WithAllowVolumeExpansion, DefinitionStages.WithMountOptions, + DefinitionStages.WithProvisioner, DefinitionStages.WithVolumeBindingMode, DefinitionStages.WithAccessModes, + DefinitionStages.WithDataResilience, DefinitionStages.WithFailoverSpeed, DefinitionStages.WithLimitations, + DefinitionStages.WithPerformance, DefinitionStages.WithPriority, DefinitionStages.WithTypeProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageClassResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageClassResource create(Context context); + } + + /** + * The stage of the StorageClassResource definition allowing to specify allowVolumeExpansion. + */ + interface WithAllowVolumeExpansion { + /** + * Specifies the allowVolumeExpansion property: Volume can be expanded or not. + * + * @param allowVolumeExpansion Volume can be expanded or not. + * @return the next definition stage. + */ + WithCreate withAllowVolumeExpansion(VolumeExpansion allowVolumeExpansion); + } + + /** + * The stage of the StorageClassResource definition allowing to specify mountOptions. + */ + interface WithMountOptions { + /** + * Specifies the mountOptions property: Additional mount options. + * + * @param mountOptions Additional mount options. + * @return the next definition stage. + */ + WithCreate withMountOptions(List mountOptions); + } + + /** + * The stage of the StorageClassResource definition allowing to specify provisioner. + */ + interface WithProvisioner { + /** + * Specifies the provisioner property: Provisioner name. + * + * @param provisioner Provisioner name. + * @return the next definition stage. + */ + WithCreate withProvisioner(String provisioner); + } + + /** + * The stage of the StorageClassResource definition allowing to specify volumeBindingMode. + */ + interface WithVolumeBindingMode { + /** + * Specifies the volumeBindingMode property: Binding mode of volumes: Immediate, WaitForFirstConsumer. + * + * @param volumeBindingMode Binding mode of volumes: Immediate, WaitForFirstConsumer. + * @return the next definition stage. + */ + WithCreate withVolumeBindingMode(VolumeBindingMode volumeBindingMode); + } + + /** + * The stage of the StorageClassResource definition allowing to specify accessModes. + */ + interface WithAccessModes { + /** + * Specifies the accessModes property: The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * + * @param accessModes The access mode: [ReadWriteOnce, ReadWriteMany] or [ReadWriteOnce]. + * @return the next definition stage. + */ + WithCreate withAccessModes(List accessModes); + } + + /** + * The stage of the StorageClassResource definition allowing to specify dataResilience. + */ + interface WithDataResilience { + /** + * Specifies the dataResilience property: Allow single data node failure. + * + * @param dataResilience Allow single data node failure. + * @return the next definition stage. + */ + WithCreate withDataResilience(DataResilienceTier dataResilience); + } + + /** + * The stage of the StorageClassResource definition allowing to specify failoverSpeed. + */ + interface WithFailoverSpeed { + /** + * Specifies the failoverSpeed property: Failover speed: NA, Slow, Fast. + * + * @param failoverSpeed Failover speed: NA, Slow, Fast. + * @return the next definition stage. + */ + WithCreate withFailoverSpeed(FailoverTier failoverSpeed); + } + + /** + * The stage of the StorageClassResource definition allowing to specify limitations. + */ + interface WithLimitations { + /** + * Specifies the limitations property: Limitations of the storage class. + * + * @param limitations Limitations of the storage class. + * @return the next definition stage. + */ + WithCreate withLimitations(List limitations); + } + + /** + * The stage of the StorageClassResource definition allowing to specify performance. + */ + interface WithPerformance { + /** + * Specifies the performance property: Performance tier. + * + * @param performance Performance tier. + * @return the next definition stage. + */ + WithCreate withPerformance(PerformanceTier performance); + } + + /** + * The stage of the StorageClassResource definition allowing to specify priority. + */ + interface WithPriority { + /** + * Specifies the priority property: Selection priority when multiple storage classes meet the criteria. 0: + * Highest, -1: Never use. + * + * @param priority Selection priority when multiple storage classes meet the criteria. 0: Highest, -1: Never + * use. + * @return the next definition stage. + */ + WithCreate withPriority(Long priority); + } + + /** + * The stage of the StorageClassResource definition allowing to specify typeProperties. + */ + interface WithTypeProperties { + /** + * Specifies the typeProperties property: Properties of the StorageClass. + * + * @param typeProperties Properties of the StorageClass. + * @return the next definition stage. + */ + WithCreate withTypeProperties(StorageClassTypeProperties typeProperties); + } + } + + /** + * Begins update for the StorageClassResource resource. + * + * @return the stage of resource update. + */ + StorageClassResource.Update update(); + + /** + * The template for StorageClassResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageClassResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageClassResource apply(Context context); + } + + /** + * The StorageClassResource update stages. + */ + interface UpdateStages { + /** + * The stage of the StorageClassResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The properties of StorageClass. + * + * @param properties The properties of StorageClass. + * @return the next definition stage. + */ + Update withProperties(StorageClassPropertiesUpdate properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageClassResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageClassResource refresh(Context context); +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResourceListResult.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResourceListResult.java new file mode 100644 index 000000000000..0fc259a151d1 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResourceListResult.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesruntime.fluent.models.StorageClassResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a StorageClassResource list operation. + */ +@Fluent +public final class StorageClassResourceListResult implements JsonSerializable { + /* + * The StorageClassResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of StorageClassResourceListResult class. + */ + public StorageClassResourceListResult() { + } + + /** + * Get the value property: The StorageClassResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The StorageClassResource items on this page. + * + * @param value the value value to set. + * @return the StorageClassResourceListResult object itself. + */ + public StorageClassResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the StorageClassResourceListResult object itself. + */ + public StorageClassResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model StorageClassResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageClassResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassResourceListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageClassResourceListResult. + */ + public static StorageClassResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassResourceListResult deserializedStorageClassResourceListResult + = new StorageClassResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> StorageClassResourceInner.fromJson(reader1)); + deserializedStorageClassResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStorageClassResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassResourceListResult; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResourceUpdate.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResourceUpdate.java new file mode 100644 index 000000000000..217c6c1e616b --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassResourceUpdate.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The model for updating a storageClass. + */ +@Fluent +public final class StorageClassResourceUpdate implements JsonSerializable { + /* + * The properties of StorageClass + */ + private StorageClassPropertiesUpdate properties; + + /** + * Creates an instance of StorageClassResourceUpdate class. + */ + public StorageClassResourceUpdate() { + } + + /** + * Get the properties property: The properties of StorageClass. + * + * @return the properties value. + */ + public StorageClassPropertiesUpdate properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of StorageClass. + * + * @param properties the properties value to set. + * @return the StorageClassResourceUpdate object itself. + */ + public StorageClassResourceUpdate withProperties(StorageClassPropertiesUpdate properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassResourceUpdate if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageClassResourceUpdate. + */ + public static StorageClassResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassResourceUpdate deserializedStorageClassResourceUpdate = new StorageClassResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedStorageClassResourceUpdate.properties = StorageClassPropertiesUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassResourceUpdate; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassTypeProperties.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassTypeProperties.java new file mode 100644 index 000000000000..706429d7eb94 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassTypeProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of storage class of the StorageClass. + */ +@Immutable +public class StorageClassTypeProperties implements JsonSerializable { + /* + * Type of the storage class. + */ + private SCType type = SCType.fromString("StorageClassTypeProperties"); + + /** + * Creates an instance of StorageClassTypeProperties class. + */ + public StorageClassTypeProperties() { + } + + /** + * Get the type property: Type of the storage class. + * + * @return the type value. + */ + public SCType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassTypeProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageClassTypeProperties. + */ + public static StorageClassTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Blob".equals(discriminatorValue)) { + return BlobStorageClassTypeProperties.fromJson(readerToUse.reset()); + } else if ("Native".equals(discriminatorValue)) { + return NativeStorageClassTypeProperties.fromJson(readerToUse.reset()); + } else if ("NFS".equals(discriminatorValue)) { + return NfsStorageClassTypeProperties.fromJson(readerToUse.reset()); + } else if ("RWX".equals(discriminatorValue)) { + return RwxStorageClassTypeProperties.fromJson(readerToUse.reset()); + } else if ("SMB".equals(discriminatorValue)) { + return SmbStorageClassTypeProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static StorageClassTypeProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassTypeProperties deserializedStorageClassTypeProperties = new StorageClassTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedStorageClassTypeProperties.type = SCType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassTypeProperties; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassTypePropertiesUpdate.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassTypePropertiesUpdate.java new file mode 100644 index 000000000000..9602db70aa12 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/StorageClassTypePropertiesUpdate.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The model for update a storageClass. + */ +@Fluent +public final class StorageClassTypePropertiesUpdate implements JsonSerializable { + /* + * The backing storageclass used to create new storageclass + */ + private String backingStorageClassName; + + /* + * Azure Storage Account Name + */ + private String azureStorageAccountName; + + /* + * Azure Storage Account Key + */ + private String azureStorageAccountKey; + + /* + * NFS Server + */ + private String server; + + /* + * NFS share + */ + private String share; + + /* + * Sub directory under share. If the sub directory doesn't exist, driver will create it + */ + private String subDir; + + /* + * Mounted folder permissions. Default is 0. If set as non-zero, driver will perform `chmod` after mount + */ + private String mountPermissions; + + /* + * The action to take when a NFS volume is deleted. Default is Delete + */ + private NfsDirectoryActionOnVolumeDeletion onDelete; + + /* + * SMB Source + */ + private String source; + + /* + * Server username + */ + private String username; + + /* + * Server password + */ + private String password; + + /* + * Server domain + */ + private String domain; + + /** + * Creates an instance of StorageClassTypePropertiesUpdate class. + */ + public StorageClassTypePropertiesUpdate() { + } + + /** + * Get the backingStorageClassName property: The backing storageclass used to create new storageclass. + * + * @return the backingStorageClassName value. + */ + public String backingStorageClassName() { + return this.backingStorageClassName; + } + + /** + * Set the backingStorageClassName property: The backing storageclass used to create new storageclass. + * + * @param backingStorageClassName the backingStorageClassName value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withBackingStorageClassName(String backingStorageClassName) { + this.backingStorageClassName = backingStorageClassName; + return this; + } + + /** + * Get the azureStorageAccountName property: Azure Storage Account Name. + * + * @return the azureStorageAccountName value. + */ + public String azureStorageAccountName() { + return this.azureStorageAccountName; + } + + /** + * Set the azureStorageAccountName property: Azure Storage Account Name. + * + * @param azureStorageAccountName the azureStorageAccountName value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withAzureStorageAccountName(String azureStorageAccountName) { + this.azureStorageAccountName = azureStorageAccountName; + return this; + } + + /** + * Get the azureStorageAccountKey property: Azure Storage Account Key. + * + * @return the azureStorageAccountKey value. + */ + public String azureStorageAccountKey() { + return this.azureStorageAccountKey; + } + + /** + * Set the azureStorageAccountKey property: Azure Storage Account Key. + * + * @param azureStorageAccountKey the azureStorageAccountKey value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withAzureStorageAccountKey(String azureStorageAccountKey) { + this.azureStorageAccountKey = azureStorageAccountKey; + return this; + } + + /** + * Get the server property: NFS Server. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: NFS Server. + * + * @param server the server value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the share property: NFS share. + * + * @return the share value. + */ + public String share() { + return this.share; + } + + /** + * Set the share property: NFS share. + * + * @param share the share value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withShare(String share) { + this.share = share; + return this; + } + + /** + * Get the subDir property: Sub directory under share. If the sub directory doesn't exist, driver will create it. + * + * @return the subDir value. + */ + public String subDir() { + return this.subDir; + } + + /** + * Set the subDir property: Sub directory under share. If the sub directory doesn't exist, driver will create it. + * + * @param subDir the subDir value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withSubDir(String subDir) { + this.subDir = subDir; + return this; + } + + /** + * Get the mountPermissions property: Mounted folder permissions. Default is 0. If set as non-zero, driver will + * perform `chmod` after mount. + * + * @return the mountPermissions value. + */ + public String mountPermissions() { + return this.mountPermissions; + } + + /** + * Set the mountPermissions property: Mounted folder permissions. Default is 0. If set as non-zero, driver will + * perform `chmod` after mount. + * + * @param mountPermissions the mountPermissions value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withMountPermissions(String mountPermissions) { + this.mountPermissions = mountPermissions; + return this; + } + + /** + * Get the onDelete property: The action to take when a NFS volume is deleted. Default is Delete. + * + * @return the onDelete value. + */ + public NfsDirectoryActionOnVolumeDeletion onDelete() { + return this.onDelete; + } + + /** + * Set the onDelete property: The action to take when a NFS volume is deleted. Default is Delete. + * + * @param onDelete the onDelete value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withOnDelete(NfsDirectoryActionOnVolumeDeletion onDelete) { + this.onDelete = onDelete; + return this; + } + + /** + * Get the source property: SMB Source. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: SMB Source. + * + * @param source the source value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the username property: Server username. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Server username. + * + * @param username the username value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Server password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Server password. + * + * @param password the password value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the domain property: Server domain. + * + * @return the domain value. + */ + public String domain() { + return this.domain; + } + + /** + * Set the domain property: Server domain. + * + * @param domain the domain value to set. + * @return the StorageClassTypePropertiesUpdate object itself. + */ + public StorageClassTypePropertiesUpdate withDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backingStorageClassName", this.backingStorageClassName); + jsonWriter.writeStringField("azureStorageAccountName", this.azureStorageAccountName); + jsonWriter.writeStringField("azureStorageAccountKey", this.azureStorageAccountKey); + jsonWriter.writeStringField("server", this.server); + jsonWriter.writeStringField("share", this.share); + jsonWriter.writeStringField("subDir", this.subDir); + jsonWriter.writeStringField("mountPermissions", this.mountPermissions); + jsonWriter.writeStringField("onDelete", this.onDelete == null ? null : this.onDelete.toString()); + jsonWriter.writeStringField("source", this.source); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("password", this.password); + jsonWriter.writeStringField("domain", this.domain); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageClassTypePropertiesUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageClassTypePropertiesUpdate if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageClassTypePropertiesUpdate. + */ + public static StorageClassTypePropertiesUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageClassTypePropertiesUpdate deserializedStorageClassTypePropertiesUpdate + = new StorageClassTypePropertiesUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backingStorageClassName".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.backingStorageClassName = reader.getString(); + } else if ("azureStorageAccountName".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.azureStorageAccountName = reader.getString(); + } else if ("azureStorageAccountKey".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.azureStorageAccountKey = reader.getString(); + } else if ("server".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.server = reader.getString(); + } else if ("share".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.share = reader.getString(); + } else if ("subDir".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.subDir = reader.getString(); + } else if ("mountPermissions".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.mountPermissions = reader.getString(); + } else if ("onDelete".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.onDelete + = NfsDirectoryActionOnVolumeDeletion.fromString(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.source = reader.getString(); + } else if ("username".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.password = reader.getString(); + } else if ("domain".equals(fieldName)) { + deserializedStorageClassTypePropertiesUpdate.domain = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageClassTypePropertiesUpdate; + }); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/VolumeBindingMode.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/VolumeBindingMode.java new file mode 100644 index 000000000000..9354e29606d1 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/VolumeBindingMode.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Storage class volume binding mode. + */ +public final class VolumeBindingMode extends ExpandableStringEnum { + /** + * Static value Immediate for VolumeBindingMode. + */ + public static final VolumeBindingMode IMMEDIATE = fromString("Immediate"); + + /** + * Static value WaitForFirstConsumer for VolumeBindingMode. + */ + public static final VolumeBindingMode WAIT_FOR_FIRST_CONSUMER = fromString("WaitForFirstConsumer"); + + /** + * Creates a new instance of VolumeBindingMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VolumeBindingMode() { + } + + /** + * Creates or finds a VolumeBindingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding VolumeBindingMode. + */ + public static VolumeBindingMode fromString(String name) { + return fromString(name, VolumeBindingMode.class); + } + + /** + * Gets known VolumeBindingMode values. + * + * @return known VolumeBindingMode values. + */ + public static Collection values() { + return values(VolumeBindingMode.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/VolumeExpansion.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/VolumeExpansion.java new file mode 100644 index 000000000000..55a9e124652b --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/VolumeExpansion.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.kubernetesruntime.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Ability to expand volumes of a storage class. + */ +public final class VolumeExpansion extends ExpandableStringEnum { + /** + * Static value Allow for VolumeExpansion. + */ + public static final VolumeExpansion ALLOW = fromString("Allow"); + + /** + * Static value Disallow for VolumeExpansion. + */ + public static final VolumeExpansion DISALLOW = fromString("Disallow"); + + /** + * Creates a new instance of VolumeExpansion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VolumeExpansion() { + } + + /** + * Creates or finds a VolumeExpansion from its string representation. + * + * @param name a name to look for. + * @return the corresponding VolumeExpansion. + */ + public static VolumeExpansion fromString(String name) { + return fromString(name, VolumeExpansion.class); + } + + /** + * Gets known VolumeExpansion values. + * + * @return known VolumeExpansion values. + */ + public static Collection values() { + return values(VolumeExpansion.class); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/package-info.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/package-info.java new file mode 100644 index 000000000000..39e3692f52f0 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/models/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftKubernetesRuntime. + * null. + */ +package com.azure.resourcemanager.kubernetesruntime.models; diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/package-info.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/package-info.java new file mode 100644 index 000000000000..7d9224b03f26 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/com/azure/resourcemanager/kubernetesruntime/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftKubernetesRuntime. + * null. + */ +package com.azure.resourcemanager.kubernetesruntime; diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/module-info.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/module-info.java new file mode 100644 index 000000000000..70e996eb2450 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.kubernetesruntime { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.kubernetesruntime; + exports com.azure.resourcemanager.kubernetesruntime.fluent; + exports com.azure.resourcemanager.kubernetesruntime.fluent.models; + exports com.azure.resourcemanager.kubernetesruntime.models; + opens com.azure.resourcemanager.kubernetesruntime.fluent.models to com.azure.core; + opens com.azure.resourcemanager.kubernetesruntime.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesruntime/proxy-config.json b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesruntime/proxy-config.json new file mode 100644 index 000000000000..022bf310fbc0 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesruntime/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.kubernetesruntime.implementation.BgpPeersClientImpl$BgpPeersService"],["com.azure.resourcemanager.kubernetesruntime.implementation.LoadBalancersClientImpl$LoadBalancersService"],["com.azure.resourcemanager.kubernetesruntime.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.kubernetesruntime.implementation.ServicesClientImpl$ServicesService"],["com.azure.resourcemanager.kubernetesruntime.implementation.StorageClassClientImpl$StorageClassService"]] \ No newline at end of file diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesruntime/reflect-config.json b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesruntime/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesruntime/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersCreateOrUpdateSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..aa09bbee72cc --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersCreateOrUpdateSamples.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.kubernetesruntime.generated; + +/** + * Samples for BgpPeers CreateOrUpdate. + */ +public final class BgpPeersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_CreateOrUpdate.json + */ + /** + * Sample code: BgpPeers_CreateOrUpdate. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + bgpPeersCreateOrUpdate(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .define("testpeer") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .withMyAsn(64500) + .withPeerAsn(64501) + .withPeerAddress("10.0.0.1") + .create(); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersDeleteSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersDeleteSamples.java new file mode 100644 index 000000000000..276b4f4c08af --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for BgpPeers Delete. + */ +public final class BgpPeersDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_Delete.json + */ + /** + * Sample code: BgpPeers_Delete. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void bgpPeersDelete(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .deleteByResourceGroupWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testpeer", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersGetSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersGetSamples.java new file mode 100644 index 000000000000..c155da9f3837 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for BgpPeers Get. + */ +public final class BgpPeersGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_Get.json + */ + /** + * Sample code: BgpPeers_Get. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void bgpPeersGet(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testpeer", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersListSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersListSamples.java new file mode 100644 index 000000000000..d3fdf5246e09 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/BgpPeersListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for BgpPeers List. + */ +public final class BgpPeersListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * BgpPeers_List.json + */ + /** + * Sample code: BgpPeers_List. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void bgpPeersList(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.bgpPeers() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersCreateOrUpdateSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d0549e629b4c --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersCreateOrUpdateSamples.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.kubernetesruntime.generated; + +import com.azure.resourcemanager.kubernetesruntime.models.AdvertiseMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for LoadBalancers CreateOrUpdate. + */ +public final class LoadBalancersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_CreateOrUpdate.json + */ + /** + * Sample code: LoadBalancers_CreateOrUpdate. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + loadBalancersCreateOrUpdate(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .define("testlb") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .withAddresses(Arrays.asList("192.168.50.1/24", "192.168.51.2-192.168.51.10")) + .withServiceSelector(mapOf("app", "frontend")) + .withAdvertiseMode(AdvertiseMode.ARP) + .create(); + } + + // Use "Map.of" if available + @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/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersDeleteSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersDeleteSamples.java new file mode 100644 index 000000000000..07f4916d9de7 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersDeleteSamples.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.kubernetesruntime.generated; + +/** + * Samples for LoadBalancers Delete. + */ +public final class LoadBalancersDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_Delete.json + */ + /** + * Sample code: LoadBalancers_Delete. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + loadBalancersDelete(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .deleteByResourceGroupWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testlb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersGetSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersGetSamples.java new file mode 100644 index 000000000000..6a722190daaa --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for LoadBalancers Get. + */ +public final class LoadBalancersGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_Get.json + */ + /** + * Sample code: LoadBalancers_Get. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void loadBalancersGet(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testlb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersListSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersListSamples.java new file mode 100644 index 000000000000..500f3e86ba8e --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/LoadBalancersListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for LoadBalancers List. + */ +public final class LoadBalancersListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * LoadBalancers_List.json + */ + /** + * Sample code: LoadBalancers_List. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void loadBalancersList(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.loadBalancers() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/OperationsListSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/OperationsListSamples.java new file mode 100644 index 000000000000..f967b6749d50 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/OperationsListSamples.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.kubernetesruntime.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Operations_List.json + */ + /** + * Sample code: Operations_List_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void operationsList0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesCreateOrUpdateSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3708fa0e3672 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for Services CreateOrUpdate. + */ +public final class ServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_CreateOrUpdate.json + */ + /** + * Sample code: Services_CreateOrUpdate. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + servicesCreateOrUpdate(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .define("storageclass") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .create(); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesDeleteSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesDeleteSamples.java new file mode 100644 index 000000000000..076b47b8e9ce --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for Services Delete. + */ +public final class ServicesDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_Delete.json + */ + /** + * Sample code: Services_Delete. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void servicesDelete(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .deleteByResourceGroupWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "storageclass", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesGetSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesGetSamples.java new file mode 100644 index 000000000000..cda899a34985 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for Services Get. + */ +public final class ServicesGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_Get.json + */ + /** + * Sample code: Services_Get. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void servicesGet(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "storageclass", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesListSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesListSamples.java new file mode 100644 index 000000000000..0136b9299fd8 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/ServicesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for Services List. + */ +public final class ServicesListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * Services_List.json + */ + /** + * Sample code: Services_List. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void servicesList(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.services() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassCreateOrUpdateSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d52a51bd770e --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassCreateOrUpdateSamples.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.kubernetesruntime.generated; + +import com.azure.resourcemanager.kubernetesruntime.models.RwxStorageClassTypeProperties; + +/** + * Samples for StorageClass CreateOrUpdate. + */ +public final class StorageClassCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_CreateOrUpdate.json + */ + /** + * Sample code: StorageClass_CreateOrUpdate_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + storageClassCreateOrUpdate0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .define("testrwx") + .withExistingResourceUri( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1") + .withTypeProperties(new RwxStorageClassTypeProperties().withBackingStorageClassName("default")) + .create(); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassDeleteSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassDeleteSamples.java new file mode 100644 index 000000000000..5beee85acebe --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassDeleteSamples.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.kubernetesruntime.generated; + +/** + * Samples for StorageClass Delete. + */ +public final class StorageClassDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_Delete.json + */ + /** + * Sample code: StorageClass_Delete_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + storageClassDelete0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .delete( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testrwx", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassGetSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassGetSamples.java new file mode 100644 index 000000000000..f65e7260e6b6 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for StorageClass Get. + */ +public final class StorageClassGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_Get.json + */ + /** + * Sample code: StorageClass_Get_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void storageClassGet0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testrwx", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassListSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassListSamples.java new file mode 100644 index 000000000000..ebaa81d6d8a8 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesruntime.generated; + +/** + * Samples for StorageClass List. + */ +public final class StorageClassListSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_List.json + */ + /** + * Sample code: StorageClass_List_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void storageClassList0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + manager.storageClass() + .list( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassUpdateSamples.java b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassUpdateSamples.java new file mode 100644 index 000000000000..9b20b3abe323 --- /dev/null +++ b/sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/src/samples/java/com/azure/resourcemanager/kubernetesruntime/generated/StorageClassUpdateSamples.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.kubernetesruntime.generated; + +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassPropertiesUpdate; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassResource; +import com.azure.resourcemanager.kubernetesruntime.models.StorageClassTypePropertiesUpdate; + +/** + * Samples for StorageClass Update. + */ +public final class StorageClassUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesruntime/resource-manager/Microsoft.KubernetesRuntime/stable/2024-03-01/examples/ + * StorageClass_Update.json + */ + /** + * Sample code: StorageClass_Update_0. + * + * @param manager Entry point to KubernetesruntimeManager. + */ + public static void + storageClassUpdate0(com.azure.resourcemanager.kubernetesruntime.KubernetesruntimeManager manager) { + StorageClassResource resource = manager.storageClass() + .getWithResponse( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example/providers/Microsoft.Kubernetes/connectedClusters/cluster1", + "testrwx", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new StorageClassPropertiesUpdate() + .withTypeProperties(new StorageClassTypePropertiesUpdate().withBackingStorageClassName("default"))) + .apply(); + } +} diff --git a/sdk/kubernetesruntime/ci.yml b/sdk/kubernetesruntime/ci.yml new file mode 100644 index 000000000000..0a52c5c78e97 --- /dev/null +++ b/sdk/kubernetesruntime/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesruntime/ci.yml + - sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/ + exclude: + - sdk/kubernetesruntime/pom.xml + - sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesruntime/ci.yml + - sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/ + exclude: + - sdk/kubernetesruntime/pom.xml + - sdk/kubernetesruntime/azure-resourcemanager-kubernetesruntime/pom.xml + +parameters: + - name: release_azureresourcemanagerkubernetesruntime + displayName: azure-resourcemanager-kubernetesruntime + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: kubernetesruntime + Artifacts: + - name: azure-resourcemanager-kubernetesruntime + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerkubernetesruntime + releaseInBatch: ${{ parameters.release_azureresourcemanagerkubernetesruntime }} diff --git a/sdk/kubernetesruntime/pom.xml b/sdk/kubernetesruntime/pom.xml new file mode 100644 index 000000000000..eec113a8db77 --- /dev/null +++ b/sdk/kubernetesruntime/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-kubernetesruntime-service + pom + 1.0.0 + + + azure-resourcemanager-kubernetesruntime + +