From 2847a63ef16d24703580f3699166ab20f805b42b Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 16 Jul 2026 05:07:02 +0000 Subject: [PATCH] Configurations: 'specification/containerservice/resource-manager/Microsoft.ContainerService/preparedimagespecification/tspconfig.yaml', and CommitSHA: '6febc0e86632c12f81e22bd07e604d480b38481e' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6569925 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 + .../SAMPLE.md | 299 +++ .../pom.xml | 74 + ...vicePreparedImageSpecificationManager.java | 304 +++ .../fluent/OperationsClient.java | 40 + .../PreparedImageSpecificationsClient.java | 388 ++++ .../fluent/PreparedImgSpecMgmtClient.java | 62 + .../fluent/models/OperationInner.java | 150 ++ .../PreparedImageSpecificationInner.java | 205 ++ ...reparedImageSpecificationVersionInner.java | 146 ++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../implementation/OperationImpl.java | 52 + .../implementation/OperationsClientImpl.java | 242 +++ .../implementation/OperationsImpl.java | 46 + .../PreparedImageSpecificationImpl.java | 215 ++ ...PreparedImageSpecificationVersionImpl.java | 51 + ...PreparedImageSpecificationsClientImpl.java | 1814 +++++++++++++++++ .../PreparedImageSpecificationsImpl.java | 205 ++ .../PreparedImgSpecMgmtClientBuilder.java | 138 ++ .../PreparedImgSpecMgmtClientImpl.java | 324 +++ .../implementation/ResourceManagerUtils.java | 195 ++ .../models/OperationListResult.java | 96 + .../PreparedImageSpecificationListResult.java | 98 + ...edImageSpecificationVersionListResult.java | 98 + .../implementation/package-info.java | 9 + .../models/ActionType.java | 46 + .../models/ExecutionPoint.java | 51 + .../models/Operation.java | 58 + .../models/OperationDisplay.java | 128 ++ .../models/Operations.java | 35 + .../models/Origin.java | 57 + .../models/PostScriptAction.java | 51 + .../models/PreparedImageSpecification.java | 309 +++ ...geSpecificationManagedIdentityProfile.java | 120 ++ .../PreparedImageSpecificationPatch.java | 88 + .../PreparedImageSpecificationProperties.java | 208 ++ .../PreparedImageSpecificationScript.java | 212 ++ .../PreparedImageSpecificationVersion.java | 57 + .../models/PreparedImageSpecifications.java | 251 +++ .../models/ProvisioningState.java | 76 + .../models/ScriptType.java | 51 + .../models/package-info.java | 9 + .../package-info.java | 9 + .../src/main/java/module-info.java | 16 + ...tainerservicepreparedimgspec_metadata.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...containerservicepreparedimgspec.properties | 1 + .../generated/OperationsListSamples.java | 23 + ...redImageSpecificationsCreateOrSamples.java | 58 + ...paredImageSpecificationsDeleteSamples.java | 24 + ...redImageSpecificationsDeleteVeSamples.java | 25 + ...redImageSpecificationsGetByResSamples.java | 24 + ...redImageSpecificationsGetVersiSamples.java | 25 + ...redImageSpecificationsListByReSamples.java | 23 + ...reparedImageSpecificationsListSamples.java | 23 + ...redImageSpecificationsListVersSamples.java | 24 + ...paredImageSpecificationsUpdateSamples.java | 42 + .../generated/OperationDisplayTests.java | 17 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../generated/OperationsListMockTests.java | 37 + .../PreparedImageSpecificationInnerTests.java | 79 + ...aredImageSpecificationListResultTests.java | 36 + ...ImageSpecificationManagedIdentitTests.java | 27 + .../PreparedImageSpecificationPatchTests.java | 41 + ...aredImageSpecificationPropertiesTests.java | 67 + ...PreparedImageSpecificationScriptTests.java | 41 + ...edImageSpecificationVersionInnerTests.java | 31 + ...ImageSpecificationVersionListResTests.java | 34 + ...ImageSpecificationsCreateOrUMockTests.java | 92 + ...ImageSpecificationsGetByResoMockTests.java | 55 + ...ImageSpecificationsGetVersioMockTests.java | 52 + ...ImageSpecificationsListByResMockTests.java | 55 + ...paredImageSpecificationsListMockTests.java | 56 + ...ImageSpecificationsListVersiMockTests.java | 55 + .../tsp-location.yaml | 4 + sdk/containerservice/ci.yml | 16 +- sdk/containerservice/pom.xml | 1 + 82 files changed, 8335 insertions(+), 4 deletions(-) create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/CHANGELOG.md create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/README.md create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/SAMPLE.md create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/pom.xml create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/ContainerServicePreparedImageSpecificationManager.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/OperationsClient.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImageSpecificationsClient.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImgSpecMgmtClient.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/OperationInner.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationInner.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationVersionInner.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/package-info.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/package-info.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsClientImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationVersionImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsClientImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientBuilder.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientImpl.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/ResourceManagerUtils.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/OperationListResult.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationListResult.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationVersionListResult.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/package-info.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ActionType.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ExecutionPoint.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operation.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/OperationDisplay.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operations.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Origin.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PostScriptAction.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecification.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationManagedIdentityProfile.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationPatch.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationProperties.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationScript.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationVersion.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecifications.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ProvisioningState.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ScriptType.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/package-info.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/package-info.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/module-info.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/azure-resourcemanager-containerservicepreparedimgspec_metadata.json create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/proxy-config.json create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/reflect-config.json create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/azure-resourcemanager-containerservicepreparedimgspec.properties create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteVeSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersiSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByReSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsUpdateSamples.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationDisplayTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationInnerTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationListResultTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationInnerTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationListResultTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationManagedIdentitTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPatchTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPropertiesTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationScriptTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionInnerTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionListResTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrUMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResoMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersioMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByResMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersiMockTests.java create mode 100644 sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/tsp-location.yaml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index da45efce8a59..feb2a5688bec 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -536,6 +536,7 @@ com.azure.resourcemanager:azure-resourcemanager-resiliencemanagement;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-napsteromniagentapi;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-commvaultcontentstore;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-billing-trust;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-containerservicepreparedimgspec;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 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/CHANGELOG.md b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/CHANGELOG.md new file mode 100644 index 000000000000..b10d4f4cb37f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-07-16) + +- Azure Resource Manager Container Service Prepared Image Specification client library for Java. This package contains Microsoft Azure SDK for Container Service Prepared Image Specification Management SDK. Azure Kubernetes Prepared Image Specification api client. Package api-version 2026-02-02-preview. 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-containerservicepreparedimgspec Java SDK. diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/README.md b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/README.md new file mode 100644 index 000000000000..4ddecbf45b78 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Container Service Prepared Image Specification client library for Java + +Azure Resource Manager Container Service Prepared Image Specification client library for Java. + +This package contains Microsoft Azure SDK for Container Service Prepared Image Specification Management SDK. Azure Kubernetes Prepared Image Specification api client. Package api-version 2026-02-02-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-containerservicepreparedimgspec;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-containerservicepreparedimgspec + 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(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ContainerServicePreparedImageSpecificationManager manager = ContainerServicePreparedImageSpecificationManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/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/ diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/SAMPLE.md b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/SAMPLE.md new file mode 100644 index 000000000000..89047afb0ef9 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/SAMPLE.md @@ -0,0 +1,299 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## PreparedImageSpecifications + +- [CreateOrUpdate](#preparedimagespecifications_createorupdate) +- [Delete](#preparedimagespecifications_delete) +- [DeleteVersion](#preparedimagespecifications_deleteversion) +- [GetByResourceGroup](#preparedimagespecifications_getbyresourcegroup) +- [GetVersion](#preparedimagespecifications_getversion) +- [List](#preparedimagespecifications_list) +- [ListByResourceGroup](#preparedimagespecifications_listbyresourcegroup) +- [ListVersions](#preparedimagespecifications_listversions) +- [Update](#preparedimagespecifications_update) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-02-02-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void operationsList( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_CreateOrUpdate + +```java +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PreparedImageSpecifications CreateOrUpdate. + */ +public final class PreparedImageSpecificationsCreateOrSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_CreateOrUpdate.json + */ + /** + * Sample code: PreparedImageSpecifications_CreateOrUpdate. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsCreateOrUpdate( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .define("my-prepared-image-specification") + .withRegion("westus2") + .withExistingResourceGroup("rg1") + .withTags(mapOf("team", "blue")) + .withProperties(new PreparedImageSpecificationProperties().withContainerImages(Arrays.asList("redis:8.0.0")) + .withIdentityProfile(new PreparedImageSpecificationManagedIdentityProfile().withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")) + .withVersion("20250101-abcd1234") + .withCustomizationScripts(Arrays.asList(new PreparedImageSpecificationScript() + .withName("initialize-node") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.BASH) + .withScript("echo \"test prepared image specification\" > /var/log/test-node-customization.txt")))) + .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; + } +} +``` + +### PreparedImageSpecifications_Delete + +```java +/** + * Samples for PreparedImageSpecifications Delete. + */ +public final class PreparedImageSpecificationsDeleteSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_Delete.json + */ + /** + * Sample code: PreparedImageSpecifications_Delete. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsDelete( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .delete("rg1", "my-prepared-image-specification", null, com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_DeleteVersion + +```java +/** + * Samples for PreparedImageSpecifications DeleteVersion. + */ +public final class PreparedImageSpecificationsDeleteVeSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_DeleteVersion.json + */ + /** + * Sample code: PreparedImageSpecifications_DeleteVersion. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsDeleteVersion( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .deleteVersion("rg1", "my-prepared-image-specification", "20250101-abcd1234", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_GetByResourceGroup + +```java +/** + * Samples for PreparedImageSpecifications GetByResourceGroup. + */ +public final class PreparedImageSpecificationsGetByResSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_Get.json + */ + /** + * Sample code: PreparedImageSpecifications_Get. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsGet( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .getByResourceGroupWithResponse("rg1", "my-prepared-image-specification", com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_GetVersion + +```java +/** + * Samples for PreparedImageSpecifications GetVersion. + */ +public final class PreparedImageSpecificationsGetVersiSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_GetVersion.json + */ + /** + * Sample code: PreparedImageSpecifications_GetVersion. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsGetVersion( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .getVersionWithResponse("rg1", "my-prepared-image-specification", "20250101-abcd1234", + com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_List + +```java +/** + * Samples for PreparedImageSpecifications List. + */ +public final class PreparedImageSpecificationsListSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_ListBySubscription.json + */ + /** + * Sample code: PreparedImageSpecifications_ListBySubscription. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsListBySubscription( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_ListByResourceGroup + +```java +/** + * Samples for PreparedImageSpecifications ListByResourceGroup. + */ +public final class PreparedImageSpecificationsListByReSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_ListByResourceGroup.json + */ + /** + * Sample code: PreparedImageSpecifications_ListByResourceGroup. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsListByResourceGroup( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_ListVersions + +```java +/** + * Samples for PreparedImageSpecifications ListVersions. + */ +public final class PreparedImageSpecificationsListVersSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_ListVersions.json + */ + /** + * Sample code: PreparedImageSpecifications_ListVersions. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsListVersions( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .listVersions("rg1", "my-prepared-image-specification", com.azure.core.util.Context.NONE); + } +} +``` + +### PreparedImageSpecifications_Update + +```java +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PreparedImageSpecifications Update. + */ +public final class PreparedImageSpecificationsUpdateSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_Update.json + */ + /** + * Sample code: PreparedImageSpecifications_Update. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsUpdate( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + PreparedImageSpecification resource = manager.preparedImageSpecifications() + .getByResourceGroupWithResponse("rg1", "my-prepared-image-specification", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key5558", "fakeTokenPlaceholder")).apply(); + } + + // 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/pom.xml b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/pom.xml new file mode 100644 index 000000000000..f1b9c1e8ad8a --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-containerservicepreparedimgspec + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Container Service Prepared Image Specification Management + This package contains Microsoft Azure SDK for Container Service Prepared Image Specification Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Kubernetes Prepared Image Specification api client. Package api-version 2026-02-02-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.58.1 + + + com.azure + azure-core-management + 1.19.5 + + + com.azure + azure-core-test + 1.27.0-beta.16 + test + + + com.azure + azure-identity + 1.18.4 + test + + + diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/ContainerServicePreparedImageSpecificationManager.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/ContainerServicePreparedImageSpecificationManager.java new file mode 100644 index 000000000000..fc9c234e9035 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/ContainerServicePreparedImageSpecificationManager.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec; + +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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImgSpecMgmtClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.OperationsImpl; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.PreparedImageSpecificationsImpl; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.PreparedImgSpecMgmtClientBuilder; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.Operations; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecifications; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ContainerServicePreparedImageSpecificationManager. + * Azure Kubernetes Prepared Image Specification api client. + */ +public final class ContainerServicePreparedImageSpecificationManager { + private Operations operations; + + private PreparedImageSpecifications preparedImageSpecifications; + + private final PreparedImgSpecMgmtClient clientObject; + + private ContainerServicePreparedImageSpecificationManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new PreparedImgSpecMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Container Service Prepared Image Specification service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Container Service Prepared Image Specification service API instance. + */ + public static ContainerServicePreparedImageSpecificationManager 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 Container Service Prepared Image Specification service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Container Service Prepared Image Specification service API instance. + */ + public static ContainerServicePreparedImageSpecificationManager authenticate(HttpPipeline httpPipeline, + AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ContainerServicePreparedImageSpecificationManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ContainerServicePreparedImageSpecificationManager with + * optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ContainerServicePreparedImageSpecificationManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-containerservicepreparedimgspec.properties"); + + 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 Container Service Prepared Image Specification service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Container Service Prepared Image Specification service API instance. + */ + public ContainerServicePreparedImageSpecificationManager authenticate(TokenCredential credential, + AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.containerservicepreparedimgspec") + .append("/") + .append(clientVersion); + 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 BearerTokenAuthenticationPolicy(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 ContainerServicePreparedImageSpecificationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of PreparedImageSpecifications. It manages PreparedImageSpecification. + * + * @return Resource collection API of PreparedImageSpecifications. + */ + public PreparedImageSpecifications preparedImageSpecifications() { + if (this.preparedImageSpecifications == null) { + this.preparedImageSpecifications + = new PreparedImageSpecificationsImpl(clientObject.getPreparedImageSpecifications(), this); + } + return preparedImageSpecifications; + } + + /** + * Gets wrapped service client PreparedImgSpecMgmtClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client PreparedImgSpecMgmtClient. + */ + public PreparedImgSpecMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/OperationsClient.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/OperationsClient.java new file mode 100644 index 000000000000..bc06d9795dcd --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImageSpecificationsClient.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImageSpecificationsClient.java new file mode 100644 index 000000000000..9a99b8b634bd --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImageSpecificationsClient.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationPatch; + +/** + * An instance of this class provides access to all the operations defined in PreparedImageSpecificationsClient. + */ +public interface PreparedImageSpecificationsClient { + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String preparedImageSpecificationName, Context context); + + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PreparedImageSpecificationInner getByResourceGroup(String resourceGroupName, String preparedImageSpecificationName); + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PreparedImageSpecificationInner> beginCreateOrUpdate( + String resourceGroupName, String preparedImageSpecificationName, PreparedImageSpecificationInner resource); + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PreparedImageSpecificationInner> beginCreateOrUpdate( + String resourceGroupName, String preparedImageSpecificationName, PreparedImageSpecificationInner resource, + String ifMatch, String ifNoneMatch, Context context); + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PreparedImageSpecificationInner createOrUpdate(String resourceGroupName, String preparedImageSpecificationName, + PreparedImageSpecificationInner resource); + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PreparedImageSpecificationInner createOrUpdate(String resourceGroupName, String preparedImageSpecificationName, + PreparedImageSpecificationInner resource, String ifMatch, String ifNoneMatch, Context context); + + /** + * Update the tags of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationPatch properties, String ifMatch, + Context context); + + /** + * Update the tags of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PreparedImageSpecificationInner update(String resourceGroupName, String preparedImageSpecificationName, + PreparedImageSpecificationPatch properties); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String preparedImageSpecificationName); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String preparedImageSpecificationName, + String ifMatch, Context context); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String preparedImageSpecificationName); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String preparedImageSpecificationName, String ifMatch, Context context); + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginDeleteVersion(String resourceGroupName, + String preparedImageSpecificationName, String version); + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginDeleteVersion(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch, Context context); + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version); + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version, String ifMatch, + Context context); + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @throws com.azure.core.management.exception.ManagementException 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 PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getVersionWithResponse(String resourceGroupName, + String preparedImageSpecificationName, String version, Context context); + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PreparedImageSpecificationVersionInner getVersion(String resourceGroupName, String preparedImageSpecificationName, + String version); + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName); + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName, Context context); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImgSpecMgmtClient.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImgSpecMgmtClient.java new file mode 100644 index 000000000000..d7ade84fc67b --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImgSpecMgmtClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for PreparedImgSpecMgmtClient class. + */ +public interface PreparedImgSpecMgmtClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PreparedImageSpecificationsClient object to access its operations. + * + * @return the PreparedImageSpecificationsClient object. + */ + PreparedImageSpecificationsClient getPreparedImageSpecifications(); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/OperationInner.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/OperationInner.java new file mode 100644 index 000000000000..b2914dda4f57 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.models.ActionType; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.OperationDisplay; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +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 Azure + * Resource Manager/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; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private 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 Azure Resource Manager/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; + } + + /** + * 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: Extensible 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; + } + + /** + * {@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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationInner.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationInner.java new file mode 100644 index 000000000000..8c59e72cb969 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationInner.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +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.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The Prepared Image Specification resource. + */ +@Fluent +public final class PreparedImageSpecificationInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private PreparedImageSpecificationProperties properties; + + /* + * If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. + * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity + * tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section + * 14.27) header fields. + */ + private String eTag; + + /* + * 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 PreparedImageSpecificationInner class. + */ + public PreparedImageSpecificationInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PreparedImageSpecificationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the PreparedImageSpecificationInner object itself. + */ + public PreparedImageSpecificationInner withProperties(PreparedImageSpecificationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the eTag property: If eTag is provided in the response body, it may also be provided as a header per the + * normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. + * HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), + * and If-Range (section 14.27) header fields. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public PreparedImageSpecificationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PreparedImageSpecificationInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreparedImageSpecificationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationInner 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 PreparedImageSpecificationInner. + */ + public static PreparedImageSpecificationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationInner deserializedPreparedImageSpecificationInner + = new PreparedImageSpecificationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPreparedImageSpecificationInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.properties + = PreparedImageSpecificationProperties.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.eTag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedPreparedImageSpecificationInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationInner; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationVersionInner.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationVersionInner.java new file mode 100644 index 000000000000..be09a13b20a2 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationVersionInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import java.io.IOException; + +/** + * A version of the Prepared Image Specification resource. + */ +@Immutable +public final class PreparedImageSpecificationVersionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PreparedImageSpecificationProperties properties; + + /* + * 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 PreparedImageSpecificationVersionInner class. + */ + private PreparedImageSpecificationVersionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PreparedImageSpecificationProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreparedImageSpecificationVersionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationVersionInner 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 PreparedImageSpecificationVersionInner. + */ + public static PreparedImageSpecificationVersionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationVersionInner deserializedPreparedImageSpecificationVersionInner + = new PreparedImageSpecificationVersionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPreparedImageSpecificationVersionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPreparedImageSpecificationVersionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPreparedImageSpecificationVersionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPreparedImageSpecificationVersionInner.properties + = PreparedImageSpecificationProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPreparedImageSpecificationVersionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationVersionInner; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/package-info.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/package-info.java new file mode 100644 index 000000000000..8b1f8e33f790 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/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) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ContainerServicePreparedImageSpecification. + * Azure Kubernetes Prepared Image Specification api client. + */ +package com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models; diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/package-info.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/package-info.java new file mode 100644 index 000000000000..a865d3c5c3b7 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/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) TypeSpec Code Generator. + +/** + * Package containing the service clients for ContainerServicePreparedImageSpecification. + * Azure Kubernetes Prepared Image Specification api client. + */ +package com.azure.resourcemanager.containerservicepreparedimgspec.fluent; diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationImpl.java new file mode 100644 index 000000000000..5dd185c34d7a --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation; + +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.OperationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ActionType; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.Operation; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.OperationDisplay; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager 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.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsClientImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..98ea3b5635d9 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.fluent.OperationsClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.OperationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.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 PreparedImgSpecMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PreparedImgSpecMgmtClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PreparedImgSpecMgmtClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PreparedImgSpecMgmtClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ContainerService/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ContainerService/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") 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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") 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() { + 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. + * + * @throws ManagementException 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. + * + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsImpl.java new file mode 100644 index 000000000000..a72ee6073279 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.fluent.OperationsClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.OperationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.Operation; +import com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager 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.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationImpl.java new file mode 100644 index 000000000000..a049d30bedb9 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationImpl.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationPatch; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import java.util.Collections; +import java.util.Map; + +public final class PreparedImageSpecificationImpl + implements PreparedImageSpecification, PreparedImageSpecification.Definition, PreparedImageSpecification.Update { + private PreparedImageSpecificationInner innerObject; + + private final com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PreparedImageSpecificationProperties properties() { + return this.innerModel().properties(); + } + + public String eTag() { + return this.innerModel().eTag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PreparedImageSpecificationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager + manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String preparedImageSpecificationName; + + private String createIfMatch; + + private String createIfNoneMatch; + + private String updateIfMatch; + + private PreparedImageSpecificationPatch updateProperties; + + public PreparedImageSpecificationImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PreparedImageSpecification create() { + this.innerObject = serviceManager.serviceClient() + .getPreparedImageSpecifications() + .createOrUpdate(resourceGroupName, preparedImageSpecificationName, this.innerModel(), createIfMatch, + createIfNoneMatch, Context.NONE); + return this; + } + + public PreparedImageSpecification create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPreparedImageSpecifications() + .createOrUpdate(resourceGroupName, preparedImageSpecificationName, this.innerModel(), createIfMatch, + createIfNoneMatch, context); + return this; + } + + PreparedImageSpecificationImpl(String name, + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager) { + this.innerObject = new PreparedImageSpecificationInner(); + this.serviceManager = serviceManager; + this.preparedImageSpecificationName = name; + this.createIfMatch = null; + this.createIfNoneMatch = null; + } + + public PreparedImageSpecificationImpl update() { + this.updateIfMatch = null; + this.updateProperties = new PreparedImageSpecificationPatch(); + return this; + } + + public PreparedImageSpecification apply() { + this.innerObject = serviceManager.serviceClient() + .getPreparedImageSpecifications() + .updateWithResponse(resourceGroupName, preparedImageSpecificationName, updateProperties, updateIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public PreparedImageSpecification apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPreparedImageSpecifications() + .updateWithResponse(resourceGroupName, preparedImageSpecificationName, updateProperties, updateIfMatch, + context) + .getValue(); + return this; + } + + PreparedImageSpecificationImpl(PreparedImageSpecificationInner innerObject, + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.preparedImageSpecificationName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "preparedImageSpecifications"); + } + + public PreparedImageSpecification refresh() { + this.innerObject = serviceManager.serviceClient() + .getPreparedImageSpecifications() + .getByResourceGroupWithResponse(resourceGroupName, preparedImageSpecificationName, Context.NONE) + .getValue(); + return this; + } + + public PreparedImageSpecification refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPreparedImageSpecifications() + .getByResourceGroupWithResponse(resourceGroupName, preparedImageSpecificationName, context) + .getValue(); + return this; + } + + public PreparedImageSpecificationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PreparedImageSpecificationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PreparedImageSpecificationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public PreparedImageSpecificationImpl withProperties(PreparedImageSpecificationProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public PreparedImageSpecificationImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.createIfMatch = ifMatch; + return this; + } else { + this.updateIfMatch = ifMatch; + return this; + } + } + + public PreparedImageSpecificationImpl withIfNoneMatch(String ifNoneMatch) { + this.createIfNoneMatch = ifNoneMatch; + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationVersionImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationVersionImpl.java new file mode 100644 index 000000000000..8c0252a93ddf --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationVersionImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationVersion; + +public final class PreparedImageSpecificationVersionImpl implements PreparedImageSpecificationVersion { + private PreparedImageSpecificationVersionInner innerObject; + + private final com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager; + + PreparedImageSpecificationVersionImpl(PreparedImageSpecificationVersionInner innerObject, + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PreparedImageSpecificationProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PreparedImageSpecificationVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsClientImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsClientImpl.java new file mode 100644 index 000000000000..595269fa27dd --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsClientImpl.java @@ -0,0 +1,1814 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.BinaryData; +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.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.PreparedImageSpecificationListResult; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.PreparedImageSpecificationVersionListResult; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationPatch; +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 PreparedImageSpecificationsClient. + */ +public final class PreparedImageSpecificationsClientImpl implements PreparedImageSpecificationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PreparedImageSpecificationsService service; + + /** + * The service client containing this operation class. + */ + private final PreparedImgSpecMgmtClientImpl client; + + /** + * Initializes an instance of PreparedImageSpecificationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PreparedImageSpecificationsClientImpl(PreparedImgSpecMgmtClientImpl client) { + this.service = RestProxy.create(PreparedImageSpecificationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PreparedImgSpecMgmtClientPreparedImageSpecifications to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PreparedImgSpecMgmtClientPreparedImageSpecifications") + public interface PreparedImageSpecificationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PreparedImageSpecificationInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PreparedImageSpecificationInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") PreparedImageSpecificationPatch properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") PreparedImageSpecificationPatch properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}/versions/{version}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @PathParam("version") String version, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}/versions/{version}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @PathParam("version") String version, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/preparedImageSpecifications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/preparedImageSpecifications") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @PathParam("version") String version, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @PathParam("version") String version, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listVersions(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/preparedImageSpecifications/{preparedImageSpecificationName}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listVersionsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("preparedImageSpecificationName") String preparedImageSpecificationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listVersionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listVersionsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName, String preparedImageSpecificationName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String preparedImageSpecificationName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, preparedImageSpecificationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String preparedImageSpecificationName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, accept, context); + } + + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PreparedImageSpecificationInner getByResourceGroup(String resourceGroupName, + String preparedImageSpecificationName) { + return getByResourceGroupWithResponse(resourceGroupName, preparedImageSpecificationName, Context.NONE) + .getValue(); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource, String ifMatch, + String ifNoneMatch) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, + preparedImageSpecificationName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource, String ifMatch, + String ifNoneMatch) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, preparedImageSpecificationName, + contentType, accept, resource, Context.NONE); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource, String ifMatch, + String ifNoneMatch, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, preparedImageSpecificationName, + contentType, accept, resource, context); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PreparedImageSpecificationInner> + beginCreateOrUpdateAsync(String resourceGroupName, String preparedImageSpecificationName, + PreparedImageSpecificationInner resource, String ifMatch, String ifNoneMatch) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + preparedImageSpecificationName, resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PreparedImageSpecificationInner.class, PreparedImageSpecificationInner.class, + this.client.getContext()); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PreparedImageSpecificationInner> + beginCreateOrUpdateAsync(String resourceGroupName, String preparedImageSpecificationName, + PreparedImageSpecificationInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + preparedImageSpecificationName, resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PreparedImageSpecificationInner.class, PreparedImageSpecificationInner.class, + this.client.getContext()); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PreparedImageSpecificationInner> beginCreateOrUpdate( + String resourceGroupName, String preparedImageSpecificationName, PreparedImageSpecificationInner resource, + String ifMatch, String ifNoneMatch) { + Response response = createOrUpdateWithResponse(resourceGroupName, preparedImageSpecificationName, + resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(response, + PreparedImageSpecificationInner.class, PreparedImageSpecificationInner.class, Context.NONE); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PreparedImageSpecificationInner> beginCreateOrUpdate( + String resourceGroupName, String preparedImageSpecificationName, PreparedImageSpecificationInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + Response response = createOrUpdateWithResponse(resourceGroupName, preparedImageSpecificationName, + resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(response, + PreparedImageSpecificationInner.class, PreparedImageSpecificationInner.class, Context.NONE); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PreparedImageSpecificationInner> beginCreateOrUpdate( + String resourceGroupName, String preparedImageSpecificationName, PreparedImageSpecificationInner resource, + String ifMatch, String ifNoneMatch, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, preparedImageSpecificationName, + resource, ifMatch, ifNoneMatch, context); + return this.client.getLroResult(response, + PreparedImageSpecificationInner.class, PreparedImageSpecificationInner.class, context); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource, String ifMatch, + String ifNoneMatch) { + return beginCreateOrUpdateAsync(resourceGroupName, preparedImageSpecificationName, resource, ifMatch, + ifNoneMatch).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 Prepared Image Specification resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + return beginCreateOrUpdateAsync(resourceGroupName, preparedImageSpecificationName, resource, ifMatch, + ifNoneMatch).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PreparedImageSpecificationInner createOrUpdate(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + return beginCreateOrUpdate(resourceGroupName, preparedImageSpecificationName, resource, ifMatch, ifNoneMatch) + .getFinalResult(); + } + + /** + * Create or update a prepared image specification resource with a client-provided version. Created versions are + * immutable; provide a different properties.version value to create a new version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the value + * provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PreparedImageSpecificationInner createOrUpdate(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationInner resource, String ifMatch, + String ifNoneMatch, Context context) { + return beginCreateOrUpdate(resourceGroupName, preparedImageSpecificationName, resource, ifMatch, ifNoneMatch, + context).getFinalResult(); + } + + /** + * Update the tags of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationPatch properties, String ifMatch) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, ifMatch, + contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the tags of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 Prepared Image Specification resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationPatch properties) { + final String ifMatch = null; + return updateWithResponseAsync(resourceGroupName, preparedImageSpecificationName, properties, ifMatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update the tags of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Prepared Image Specification resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String preparedImageSpecificationName, PreparedImageSpecificationPatch properties, String ifMatch, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, ifMatch, contentType, + accept, properties, context); + } + + /** + * Update the tags of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @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 Prepared Image Specification resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PreparedImageSpecificationInner update(String resourceGroupName, String preparedImageSpecificationName, + PreparedImageSpecificationPatch properties) { + final String ifMatch = null; + return updateWithResponse(resourceGroupName, preparedImageSpecificationName, properties, ifMatch, Context.NONE) + .getValue(); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String preparedImageSpecificationName, String ifMatch) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, preparedImageSpecificationName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String preparedImageSpecificationName, + String ifMatch) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, preparedImageSpecificationName, Context.NONE); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String preparedImageSpecificationName, + String ifMatch, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, preparedImageSpecificationName, context); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String preparedImageSpecificationName, String ifMatch) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, preparedImageSpecificationName, ifMatch); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String preparedImageSpecificationName) { + final String ifMatch = null; + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, preparedImageSpecificationName, ifMatch); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String preparedImageSpecificationName, String ifMatch) { + Response response = deleteWithResponse(resourceGroupName, preparedImageSpecificationName, ifMatch); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String preparedImageSpecificationName) { + final String ifMatch = null; + Response response = deleteWithResponse(resourceGroupName, preparedImageSpecificationName, ifMatch); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String preparedImageSpecificationName, String ifMatch, Context context) { + Response response + = deleteWithResponse(resourceGroupName, preparedImageSpecificationName, ifMatch, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String preparedImageSpecificationName, String ifMatch) { + return beginDeleteAsync(resourceGroupName, preparedImageSpecificationName, ifMatch).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String preparedImageSpecificationName) { + final String ifMatch = null; + return beginDeleteAsync(resourceGroupName, preparedImageSpecificationName, ifMatch).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String preparedImageSpecificationName) { + final String ifMatch = null; + beginDelete(resourceGroupName, preparedImageSpecificationName, ifMatch).getFinalResult(); + } + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String preparedImageSpecificationName, String ifMatch, + Context context) { + beginDelete(resourceGroupName, preparedImageSpecificationName, ifMatch, context).getFinalResult(); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> deleteVersionWithResponseAsync(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch) { + return FluxUtil + .withContext(context -> service.deleteVersion(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, preparedImageSpecificationName, version, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteVersionWithResponse(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch) { + return service.deleteVersionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, preparedImageSpecificationName, version, + Context.NONE); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteVersionWithResponse(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch, Context context) { + return service.deleteVersionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, preparedImageSpecificationName, version, + context); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDeleteVersionAsync(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch) { + Mono>> mono + = deleteVersionWithResponseAsync(resourceGroupName, preparedImageSpecificationName, version, ifMatch); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDeleteVersionAsync(String resourceGroupName, + String preparedImageSpecificationName, String version) { + final String ifMatch = null; + Mono>> mono + = deleteVersionWithResponseAsync(resourceGroupName, preparedImageSpecificationName, version, ifMatch); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDeleteVersion(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch) { + Response response + = deleteVersionWithResponse(resourceGroupName, preparedImageSpecificationName, version, ifMatch); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDeleteVersion(String resourceGroupName, + String preparedImageSpecificationName, String version) { + final String ifMatch = null; + Response response + = deleteVersionWithResponse(resourceGroupName, preparedImageSpecificationName, version, ifMatch); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDeleteVersion(String resourceGroupName, + String preparedImageSpecificationName, String version, String ifMatch, Context context) { + Response response + = deleteVersionWithResponse(resourceGroupName, preparedImageSpecificationName, version, ifMatch, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 deleteVersionAsync(String resourceGroupName, String preparedImageSpecificationName, + String version, String ifMatch) { + return beginDeleteVersionAsync(resourceGroupName, preparedImageSpecificationName, version, ifMatch).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 deleteVersionAsync(String resourceGroupName, String preparedImageSpecificationName, + String version) { + final String ifMatch = null; + return beginDeleteVersionAsync(resourceGroupName, preparedImageSpecificationName, version, ifMatch).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version) { + final String ifMatch = null; + beginDeleteVersion(resourceGroupName, preparedImageSpecificationName, version, ifMatch).getFinalResult(); + } + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version, + String ifMatch, Context context) { + beginDeleteVersion(resourceGroupName, preparedImageSpecificationName, version, ifMatch, context) + .getFinalResult(); + } + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, 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 prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, + Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @throws ManagementException 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 PreparedImageSpecification list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), 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 prepared image specifications in a subscription at the latest version. + * + * @throws ManagementException 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 PreparedImageSpecification list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @throws ManagementException 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 PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @throws ManagementException 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 PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getVersionWithResponseAsync(String resourceGroupName, + String preparedImageSpecificationName, String version) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getVersion(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, version, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getVersionAsync(String resourceGroupName, + String preparedImageSpecificationName, String version) { + return getVersionWithResponseAsync(resourceGroupName, preparedImageSpecificationName, version) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getVersionWithResponse(String resourceGroupName, + String preparedImageSpecificationName, String version, Context context) { + final String accept = "application/json"; + return service.getVersionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, version, accept, + context); + } + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PreparedImageSpecificationVersionInner getVersion(String resourceGroupName, + String preparedImageSpecificationName, String version) { + return getVersionWithResponse(resourceGroupName, preparedImageSpecificationName, version, Context.NONE) + .getValue(); + } + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listVersionsSinglePageAsync(String resourceGroupName, String preparedImageSpecificationName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listVersions(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, 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 all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listVersionsAsync(String resourceGroupName, + String preparedImageSpecificationName) { + return new PagedFlux<>(() -> listVersionsSinglePageAsync(resourceGroupName, preparedImageSpecificationName), + nextLink -> listVersionsNextSinglePageAsync(nextLink)); + } + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsSinglePage(String resourceGroupName, + String preparedImageSpecificationName) { + final String accept = "application/json"; + Response res = service.listVersionsSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + preparedImageSpecificationName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsSinglePage(String resourceGroupName, + String preparedImageSpecificationName, Context context) { + final String accept = "application/json"; + Response res + = service.listVersionsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, preparedImageSpecificationName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName) { + return new PagedIterable<>(() -> listVersionsSinglePage(resourceGroupName, preparedImageSpecificationName), + nextLink -> listVersionsNextSinglePage(nextLink)); + } + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName, Context context) { + return new PagedIterable<>( + () -> listVersionsSinglePage(resourceGroupName, preparedImageSpecificationName, context), + nextLink -> listVersionsNextSinglePage(nextLink, 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 the response of a PreparedImageSpecification list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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 PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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 PreparedImageSpecification list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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 PreparedImageSpecification list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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 PreparedImageSpecificationVersion list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listVersionsNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listVersionsNext(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PreparedImageSpecificationVersion list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listVersionsNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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 PreparedImageSpecificationVersion list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listVersionsNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsImpl.java new file mode 100644 index 000000000000..20c5995c78cf --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationVersion; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecifications; + +public final class PreparedImageSpecificationsImpl implements PreparedImageSpecifications { + private static final ClientLogger LOGGER = new ClientLogger(PreparedImageSpecificationsImpl.class); + + private final PreparedImageSpecificationsClient innerClient; + + private final com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager; + + public PreparedImageSpecificationsImpl(PreparedImageSpecificationsClient innerClient, + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String preparedImageSpecificationName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, preparedImageSpecificationName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PreparedImageSpecificationImpl(inner.getValue(), this.manager())); + } + + public PreparedImageSpecification getByResourceGroup(String resourceGroupName, + String preparedImageSpecificationName) { + PreparedImageSpecificationInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, preparedImageSpecificationName); + if (inner != null) { + return new PreparedImageSpecificationImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String preparedImageSpecificationName) { + this.serviceClient().delete(resourceGroupName, preparedImageSpecificationName); + } + + public void delete(String resourceGroupName, String preparedImageSpecificationName, String ifMatch, + Context context) { + this.serviceClient().delete(resourceGroupName, preparedImageSpecificationName, ifMatch, context); + } + + public void deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version) { + this.serviceClient().deleteVersion(resourceGroupName, preparedImageSpecificationName, version); + } + + public void deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version, + String ifMatch, Context context) { + this.serviceClient() + .deleteVersion(resourceGroupName, preparedImageSpecificationName, version, ifMatch, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PreparedImageSpecificationImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PreparedImageSpecificationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PreparedImageSpecificationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PreparedImageSpecificationImpl(inner1, this.manager())); + } + + public Response getVersionWithResponse(String resourceGroupName, + String preparedImageSpecificationName, String version, Context context) { + Response inner = this.serviceClient() + .getVersionWithResponse(resourceGroupName, preparedImageSpecificationName, version, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PreparedImageSpecificationVersionImpl(inner.getValue(), this.manager())); + } + + public PreparedImageSpecificationVersion getVersion(String resourceGroupName, String preparedImageSpecificationName, + String version) { + PreparedImageSpecificationVersionInner inner + = this.serviceClient().getVersion(resourceGroupName, preparedImageSpecificationName, version); + if (inner != null) { + return new PreparedImageSpecificationVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName) { + PagedIterable inner + = this.serviceClient().listVersions(resourceGroupName, preparedImageSpecificationName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PreparedImageSpecificationVersionImpl(inner1, this.manager())); + } + + public PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName, Context context) { + PagedIterable inner + = this.serviceClient().listVersions(resourceGroupName, preparedImageSpecificationName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PreparedImageSpecificationVersionImpl(inner1, this.manager())); + } + + public PreparedImageSpecification getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String preparedImageSpecificationName + = ResourceManagerUtils.getValueFromIdByName(id, "preparedImageSpecifications"); + if (preparedImageSpecificationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'preparedImageSpecifications'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, preparedImageSpecificationName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String preparedImageSpecificationName + = ResourceManagerUtils.getValueFromIdByName(id, "preparedImageSpecifications"); + if (preparedImageSpecificationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'preparedImageSpecifications'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, preparedImageSpecificationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String preparedImageSpecificationName + = ResourceManagerUtils.getValueFromIdByName(id, "preparedImageSpecifications"); + if (preparedImageSpecificationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'preparedImageSpecifications'.", id))); + } + String localIfMatch = null; + this.delete(resourceGroupName, preparedImageSpecificationName, localIfMatch, Context.NONE); + } + + public void deleteByIdWithResponse(String id, String ifMatch, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String preparedImageSpecificationName + = ResourceManagerUtils.getValueFromIdByName(id, "preparedImageSpecifications"); + if (preparedImageSpecificationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'preparedImageSpecifications'.", id))); + } + this.delete(resourceGroupName, preparedImageSpecificationName, ifMatch, context); + } + + private PreparedImageSpecificationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager + manager() { + return this.serviceManager; + } + + public PreparedImageSpecificationImpl define(String name) { + return new PreparedImageSpecificationImpl(name, this.manager()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientBuilder.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientBuilder.java new file mode 100644 index 000000000000..1a330abd7664 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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 PreparedImgSpecMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { PreparedImgSpecMgmtClientImpl.class }) +public final class PreparedImgSpecMgmtClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the PreparedImgSpecMgmtClientBuilder. + */ + public PreparedImgSpecMgmtClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the PreparedImgSpecMgmtClientBuilder. + */ + public PreparedImgSpecMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the PreparedImgSpecMgmtClientBuilder. + */ + public PreparedImgSpecMgmtClientBuilder 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 PreparedImgSpecMgmtClientBuilder. + */ + public PreparedImgSpecMgmtClientBuilder 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 PreparedImgSpecMgmtClientBuilder. + */ + public PreparedImgSpecMgmtClientBuilder 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 PreparedImgSpecMgmtClientBuilder. + */ + public PreparedImgSpecMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PreparedImgSpecMgmtClientImpl with the provided parameters. + * + * @return an instance of PreparedImgSpecMgmtClientImpl. + */ + public PreparedImgSpecMgmtClientImpl 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(); + PreparedImgSpecMgmtClientImpl client = new PreparedImgSpecMgmtClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientImpl.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientImpl.java new file mode 100644 index 000000000000..9f0101b70bcd --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +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.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.OperationsClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImgSpecMgmtClient; +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 PreparedImgSpecMgmtClientImpl type. + */ +@ServiceClient(builder = PreparedImgSpecMgmtClientBuilder.class) +public final class PreparedImgSpecMgmtClientImpl implements PreparedImgSpecMgmtClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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 OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The PreparedImageSpecificationsClient object to access its operations. + */ + private final PreparedImageSpecificationsClient preparedImageSpecifications; + + /** + * Gets the PreparedImageSpecificationsClient object to access its operations. + * + * @return the PreparedImageSpecificationsClient object. + */ + public PreparedImageSpecificationsClient getPreparedImageSpecifications() { + return this.preparedImageSpecifications; + } + + /** + * Initializes an instance of PreparedImgSpecMgmtClient 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 Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + PreparedImgSpecMgmtClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2026-02-02-preview"; + this.operations = new OperationsClientImpl(this); + this.preparedImageSpecifications = new PreparedImageSpecificationsClientImpl(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 long running operation result. + * + * @param activationResponse the response of activation operation. + * @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 SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.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 ? new byte[0] : 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(PreparedImgSpecMgmtClientImpl.class); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/ResourceManagerUtils.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..ee91a4f8c9a9 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/OperationListResult.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..e1f8d1f74947 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation.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.containerservicepreparedimgspec.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 { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationListResult.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationListResult.java new file mode 100644 index 000000000000..87c98660029f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation.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.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PreparedImageSpecification list operation. + */ +@Immutable +public final class PreparedImageSpecificationListResult + implements JsonSerializable { + /* + * The PreparedImageSpecification items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PreparedImageSpecificationListResult class. + */ + private PreparedImageSpecificationListResult() { + } + + /** + * Get the value property: The PreparedImageSpecification items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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 PreparedImageSpecificationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationListResult 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 PreparedImageSpecificationListResult. + */ + public static PreparedImageSpecificationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationListResult deserializedPreparedImageSpecificationListResult + = new PreparedImageSpecificationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PreparedImageSpecificationInner.fromJson(reader1)); + deserializedPreparedImageSpecificationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPreparedImageSpecificationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationListResult; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationVersionListResult.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationVersionListResult.java new file mode 100644 index 000000000000..d392db87bdc8 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationVersionListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation.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.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PreparedImageSpecificationVersion list operation. + */ +@Immutable +public final class PreparedImageSpecificationVersionListResult + implements JsonSerializable { + /* + * The PreparedImageSpecificationVersion items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PreparedImageSpecificationVersionListResult class. + */ + private PreparedImageSpecificationVersionListResult() { + } + + /** + * Get the value property: The PreparedImageSpecificationVersion items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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 PreparedImageSpecificationVersionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationVersionListResult 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 PreparedImageSpecificationVersionListResult. + */ + public static PreparedImageSpecificationVersionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationVersionListResult deserializedPreparedImageSpecificationVersionListResult + = new PreparedImageSpecificationVersionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PreparedImageSpecificationVersionInner.fromJson(reader1)); + deserializedPreparedImageSpecificationVersionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPreparedImageSpecificationVersionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationVersionListResult; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/package-info.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/package-info.java new file mode 100644 index 000000000000..191d8f9e2985 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/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) TypeSpec Code Generator. + +/** + * Package containing the implementations for ContainerServicePreparedImageSpecification. + * Azure Kubernetes Prepared Image Specification api client. + */ +package com.azure.resourcemanager.containerservicepreparedimgspec.implementation; diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ActionType.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ActionType.java new file mode 100644 index 000000000000..92b515dca8be --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ExecutionPoint.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ExecutionPoint.java new file mode 100644 index 000000000000..000541a390a8 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ExecutionPoint.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The execution point for the script. + */ +public final class ExecutionPoint extends ExpandableStringEnum { + /** + * Execute during node image build time. + */ + public static final ExecutionPoint NODE_IMAGE_BUILD_TIME = fromString("NodeImageBuildTime"); + + /** + * Execute during node provisioning time. + */ + public static final ExecutionPoint NODE_PROVISION_TIME = fromString("NodeProvisionTime"); + + /** + * Creates a new instance of ExecutionPoint value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExecutionPoint() { + } + + /** + * Creates or finds a ExecutionPoint from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExecutionPoint. + */ + public static ExecutionPoint fromString(String name) { + return fromString(name, ExecutionPoint.class); + } + + /** + * Gets known ExecutionPoint values. + * + * @return known ExecutionPoint values. + */ + public static Collection values() { + return values(ExecutionPoint.class); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operation.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operation.java new file mode 100644 index 000000000000..d33366bf0ff9 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.resourcemanager.containerservicepreparedimgspec.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 Azure Resource Manager/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: Extensible 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.containerservicepreparedimgspec.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/OperationDisplay.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/OperationDisplay.java new file mode 100644 index 000000000000..f7db2a4ff73e --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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 an 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. + */ + private 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; + } + + /** + * {@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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operations.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operations.java new file mode 100644 index 000000000000..c3e0772d9efc --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Origin.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Origin.java new file mode 100644 index 000000000000..12cf14872419 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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 { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PostScriptAction.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PostScriptAction.java new file mode 100644 index 000000000000..dd21357954d6 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PostScriptAction.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The action to take after the script finishes successfully. + */ +public final class PostScriptAction extends ExpandableStringEnum { + /** + * No post-script action is taken. + */ + public static final PostScriptAction NONE = fromString("None"); + + /** + * Reboot the node after the script completes. + */ + public static final PostScriptAction REBOOT_AFTER = fromString("RebootAfter"); + + /** + * Creates a new instance of PostScriptAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PostScriptAction() { + } + + /** + * Creates or finds a PostScriptAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding PostScriptAction. + */ + public static PostScriptAction fromString(String name) { + return fromString(name, PostScriptAction.class); + } + + /** + * Gets known PostScriptAction values. + * + * @return known PostScriptAction values. + */ + public static Collection values() { + return values(PostScriptAction.class); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecification.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecification.java new file mode 100644 index 000000000000..727d1b886f9a --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecification.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import java.util.Map; + +/** + * An immutable client-side representation of PreparedImageSpecification. + */ +public interface PreparedImageSpecification { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PreparedImageSpecificationProperties properties(); + + /** + * Gets the eTag property: If eTag is provided in the response body, it may also be provided as a header per the + * normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. + * HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), + * and If-Range (section 14.27) header fields. + * + * @return the eTag value. + */ + String eTag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner object. + * + * @return the inner object. + */ + PreparedImageSpecificationInner innerModel(); + + /** + * The entirety of the PreparedImageSpecification definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The PreparedImageSpecification definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PreparedImageSpecification definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the PreparedImageSpecification definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the PreparedImageSpecification definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the PreparedImageSpecification definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties, + DefinitionStages.WithIfMatch, DefinitionStages.WithIfNoneMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + PreparedImageSpecification create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PreparedImageSpecification create(Context context); + } + + /** + * The stage of the PreparedImageSpecification definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the PreparedImageSpecification definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(PreparedImageSpecificationProperties properties); + } + + /** + * The stage of the PreparedImageSpecification definition allowing to specify ifMatch. + */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The request should only proceed if the targeted resource's etag matches + * the value provided.. + * + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value + * provided. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the PreparedImageSpecification definition allowing to specify ifNoneMatch. + */ + interface WithIfNoneMatch { + /** + * Specifies the ifNoneMatch property: The request should only proceed if the targeted resource's etag does + * not match the value provided.. + * + * @param ifNoneMatch The request should only proceed if the targeted resource's etag does not match the + * value provided. + * @return the next definition stage. + */ + WithCreate withIfNoneMatch(String ifNoneMatch); + } + } + + /** + * Begins update for the PreparedImageSpecification resource. + * + * @return the stage of resource update. + */ + PreparedImageSpecification.Update update(); + + /** + * The template for PreparedImageSpecification update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PreparedImageSpecification apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PreparedImageSpecification apply(Context context); + } + + /** + * The PreparedImageSpecification update stages. + */ + interface UpdateStages { + /** + * The stage of the PreparedImageSpecification update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the PreparedImageSpecification update allowing to specify ifMatch. + */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The request should only proceed if the targeted resource's etag matches + * the value provided.. + * + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value + * provided. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PreparedImageSpecification refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PreparedImageSpecification refresh(Context context); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationManagedIdentityProfile.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationManagedIdentityProfile.java new file mode 100644 index 000000000000..7862e69d86e6 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationManagedIdentityProfile.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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 managed identity profile used by the prepared image specification. + */ +@Fluent +public final class PreparedImageSpecificationManagedIdentityProfile + implements JsonSerializable { + /* + * The resource ID of the user-assigned managed identity. + */ + private String resourceId; + + /* + * The object ID of the managed identity. + */ + private String objectId; + + /* + * The client ID of the managed identity. + */ + private String clientId; + + /** + * Creates an instance of PreparedImageSpecificationManagedIdentityProfile class. + */ + public PreparedImageSpecificationManagedIdentityProfile() { + } + + /** + * Get the resourceId property: The resource ID of the user-assigned managed identity. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource ID of the user-assigned managed identity. + * + * @param resourceId the resourceId value to set. + * @return the PreparedImageSpecificationManagedIdentityProfile object itself. + */ + public PreparedImageSpecificationManagedIdentityProfile withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the objectId property: The object ID of the managed identity. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the clientId property: The client ID of the managed identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreparedImageSpecificationManagedIdentityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationManagedIdentityProfile 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 PreparedImageSpecificationManagedIdentityProfile. + */ + public static PreparedImageSpecificationManagedIdentityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationManagedIdentityProfile deserializedPreparedImageSpecificationManagedIdentityProfile + = new PreparedImageSpecificationManagedIdentityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedPreparedImageSpecificationManagedIdentityProfile.resourceId = reader.getString(); + } else if ("objectId".equals(fieldName)) { + deserializedPreparedImageSpecificationManagedIdentityProfile.objectId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedPreparedImageSpecificationManagedIdentityProfile.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationManagedIdentityProfile; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationPatch.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationPatch.java new file mode 100644 index 000000000000..87bc458c3f7e --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationPatch.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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.Map; + +/** + * Prepared image specification patch resource. + */ +@Fluent +public final class PreparedImageSpecificationPatch implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of PreparedImageSpecificationPatch class. + */ + public PreparedImageSpecificationPatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PreparedImageSpecificationPatch object itself. + */ + public PreparedImageSpecificationPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreparedImageSpecificationPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationPatch 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 PreparedImageSpecificationPatch. + */ + public static PreparedImageSpecificationPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationPatch deserializedPreparedImageSpecificationPatch + = new PreparedImageSpecificationPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPreparedImageSpecificationPatch.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationPatch; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationProperties.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationProperties.java new file mode 100644 index 000000000000..7054df7fed2f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationProperties.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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 properties of the Prepared Image Specification resource. + */ +@Fluent +public final class PreparedImageSpecificationProperties + implements JsonSerializable { + /* + * The list of container images to cache on nodes. See + * https://kubernetes.io/docs/concepts/containers/images/#image-names + */ + private List containerImages; + + /* + * The identity used to execute prepared image specification tasks during image build time and provisioning time. + * If not specified the default agentpool identity will be used. + * This does not affect provisioned nodes. + */ + private PreparedImageSpecificationManagedIdentityProfile identityProfile; + + /* + * The client-provided version of the prepared image specification. + */ + private String version; + + /* + * The provisioning state of the prepared image specification. + */ + private ProvisioningState provisioningState; + + /* + * The scripts to customize the node before or after image capture. + */ + private List customizationScripts; + + /** + * Creates an instance of PreparedImageSpecificationProperties class. + */ + public PreparedImageSpecificationProperties() { + } + + /** + * Get the containerImages property: The list of container images to cache on nodes. See + * https://kubernetes.io/docs/concepts/containers/images/#image-names. + * + * @return the containerImages value. + */ + public List containerImages() { + return this.containerImages; + } + + /** + * Set the containerImages property: The list of container images to cache on nodes. See + * https://kubernetes.io/docs/concepts/containers/images/#image-names. + * + * @param containerImages the containerImages value to set. + * @return the PreparedImageSpecificationProperties object itself. + */ + public PreparedImageSpecificationProperties withContainerImages(List containerImages) { + this.containerImages = containerImages; + return this; + } + + /** + * Get the identityProfile property: The identity used to execute prepared image specification tasks during image + * build time and provisioning time. + * If not specified the default agentpool identity will be used. + * This does not affect provisioned nodes. + * + * @return the identityProfile value. + */ + public PreparedImageSpecificationManagedIdentityProfile identityProfile() { + return this.identityProfile; + } + + /** + * Set the identityProfile property: The identity used to execute prepared image specification tasks during image + * build time and provisioning time. + * If not specified the default agentpool identity will be used. + * This does not affect provisioned nodes. + * + * @param identityProfile the identityProfile value to set. + * @return the PreparedImageSpecificationProperties object itself. + */ + public PreparedImageSpecificationProperties + withIdentityProfile(PreparedImageSpecificationManagedIdentityProfile identityProfile) { + this.identityProfile = identityProfile; + return this; + } + + /** + * Get the version property: The client-provided version of the prepared image specification. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The client-provided version of the prepared image specification. + * + * @param version the version value to set. + * @return the PreparedImageSpecificationProperties object itself. + */ + public PreparedImageSpecificationProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the prepared image specification. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the customizationScripts property: The scripts to customize the node before or after image capture. + * + * @return the customizationScripts value. + */ + public List customizationScripts() { + return this.customizationScripts; + } + + /** + * Set the customizationScripts property: The scripts to customize the node before or after image capture. + * + * @param customizationScripts the customizationScripts value to set. + * @return the PreparedImageSpecificationProperties object itself. + */ + public PreparedImageSpecificationProperties + withCustomizationScripts(List customizationScripts) { + this.customizationScripts = customizationScripts; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("containerImages", this.containerImages, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identityProfile", this.identityProfile); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeArrayField("customizationScripts", this.customizationScripts, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreparedImageSpecificationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationProperties 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 PreparedImageSpecificationProperties. + */ + public static PreparedImageSpecificationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationProperties deserializedPreparedImageSpecificationProperties + = new PreparedImageSpecificationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerImages".equals(fieldName)) { + List containerImages = reader.readArray(reader1 -> reader1.getString()); + deserializedPreparedImageSpecificationProperties.containerImages = containerImages; + } else if ("identityProfile".equals(fieldName)) { + deserializedPreparedImageSpecificationProperties.identityProfile + = PreparedImageSpecificationManagedIdentityProfile.fromJson(reader); + } else if ("version".equals(fieldName)) { + deserializedPreparedImageSpecificationProperties.version = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedPreparedImageSpecificationProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("customizationScripts".equals(fieldName)) { + List customizationScripts + = reader.readArray(reader1 -> PreparedImageSpecificationScript.fromJson(reader1)); + deserializedPreparedImageSpecificationProperties.customizationScripts = customizationScripts; + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationProperties; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationScript.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationScript.java new file mode 100644 index 000000000000..dccc47a9368a --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationScript.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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; + +/** + * Prepared image specification script. + */ +@Fluent +public final class PreparedImageSpecificationScript implements JsonSerializable { + /* + * The name for the customization script. + * Must be unique within the prepared image specification resource. + * Can only contain lowercase alphanumeric,'-' or '.' characters. + */ + private String name; + + /* + * The stage at which the script is executed. + * Specifying `NodeImageBuildTime` will ensure changes are persisted into the node image. + */ + private ExecutionPoint executionPoint; + + /* + * The runtime environment for the script (e.g. Bash). + */ + private ScriptType scriptType; + + /* + * The script content to be executed in plain text. Do not include secrets. + */ + private String script; + + /* + * The action to take after successful script execution. + */ + private PostScriptAction postScriptAction; + + /** + * Creates an instance of PreparedImageSpecificationScript class. + */ + public PreparedImageSpecificationScript() { + } + + /** + * Get the name property: The name for the customization script. + * Must be unique within the prepared image specification resource. + * Can only contain lowercase alphanumeric,'-' or '.' characters. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name for the customization script. + * Must be unique within the prepared image specification resource. + * Can only contain lowercase alphanumeric,'-' or '.' characters. + * + * @param name the name value to set. + * @return the PreparedImageSpecificationScript object itself. + */ + public PreparedImageSpecificationScript withName(String name) { + this.name = name; + return this; + } + + /** + * Get the executionPoint property: The stage at which the script is executed. + * Specifying `NodeImageBuildTime` will ensure changes are persisted into the node image. + * + * @return the executionPoint value. + */ + public ExecutionPoint executionPoint() { + return this.executionPoint; + } + + /** + * Set the executionPoint property: The stage at which the script is executed. + * Specifying `NodeImageBuildTime` will ensure changes are persisted into the node image. + * + * @param executionPoint the executionPoint value to set. + * @return the PreparedImageSpecificationScript object itself. + */ + public PreparedImageSpecificationScript withExecutionPoint(ExecutionPoint executionPoint) { + this.executionPoint = executionPoint; + return this; + } + + /** + * Get the scriptType property: The runtime environment for the script (e.g. Bash). + * + * @return the scriptType value. + */ + public ScriptType scriptType() { + return this.scriptType; + } + + /** + * Set the scriptType property: The runtime environment for the script (e.g. Bash). + * + * @param scriptType the scriptType value to set. + * @return the PreparedImageSpecificationScript object itself. + */ + public PreparedImageSpecificationScript withScriptType(ScriptType scriptType) { + this.scriptType = scriptType; + return this; + } + + /** + * Get the script property: The script content to be executed in plain text. Do not include secrets. + * + * @return the script value. + */ + public String script() { + return this.script; + } + + /** + * Set the script property: The script content to be executed in plain text. Do not include secrets. + * + * @param script the script value to set. + * @return the PreparedImageSpecificationScript object itself. + */ + public PreparedImageSpecificationScript withScript(String script) { + this.script = script; + return this; + } + + /** + * Get the postScriptAction property: The action to take after successful script execution. + * + * @return the postScriptAction value. + */ + public PostScriptAction postScriptAction() { + return this.postScriptAction; + } + + /** + * Set the postScriptAction property: The action to take after successful script execution. + * + * @param postScriptAction the postScriptAction value to set. + * @return the PreparedImageSpecificationScript object itself. + */ + public PreparedImageSpecificationScript withPostScriptAction(PostScriptAction postScriptAction) { + this.postScriptAction = postScriptAction; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("executionPoint", + this.executionPoint == null ? null : this.executionPoint.toString()); + jsonWriter.writeStringField("scriptType", this.scriptType == null ? null : this.scriptType.toString()); + jsonWriter.writeStringField("script", this.script); + jsonWriter.writeStringField("postScriptAction", + this.postScriptAction == null ? null : this.postScriptAction.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PreparedImageSpecificationScript from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PreparedImageSpecificationScript 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 PreparedImageSpecificationScript. + */ + public static PreparedImageSpecificationScript fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PreparedImageSpecificationScript deserializedPreparedImageSpecificationScript + = new PreparedImageSpecificationScript(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPreparedImageSpecificationScript.name = reader.getString(); + } else if ("executionPoint".equals(fieldName)) { + deserializedPreparedImageSpecificationScript.executionPoint + = ExecutionPoint.fromString(reader.getString()); + } else if ("scriptType".equals(fieldName)) { + deserializedPreparedImageSpecificationScript.scriptType = ScriptType.fromString(reader.getString()); + } else if ("script".equals(fieldName)) { + deserializedPreparedImageSpecificationScript.script = reader.getString(); + } else if ("postScriptAction".equals(fieldName)) { + deserializedPreparedImageSpecificationScript.postScriptAction + = PostScriptAction.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPreparedImageSpecificationScript; + }); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationVersion.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationVersion.java new file mode 100644 index 000000000000..79b8d6038c51 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationVersion.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; + +/** + * An immutable client-side representation of PreparedImageSpecificationVersion. + */ +public interface PreparedImageSpecificationVersion { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PreparedImageSpecificationProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner + * com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner + * object. + * + * @return the inner object. + */ + PreparedImageSpecificationVersionInner innerModel(); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecifications.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecifications.java new file mode 100644 index 000000000000..d862b98880ef --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecifications.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.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 PreparedImageSpecifications. + */ +public interface PreparedImageSpecifications { + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String preparedImageSpecificationName, Context context); + + /** + * Get a prepared image specification at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 a prepared image specification at the latest version. + */ + PreparedImageSpecification getByResourceGroup(String resourceGroupName, String preparedImageSpecificationName); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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. + */ + void deleteByResourceGroup(String resourceGroupName, String preparedImageSpecificationName); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String preparedImageSpecificationName, String ifMatch, Context context); + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version); + + /** + * Delete a prepared image specification version. This operation will be blocked if the prepared image specification + * version is in use. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteVersion(String resourceGroupName, String preparedImageSpecificationName, String version, String ifMatch, + Context context); + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the prepared image specifications in a resource group at the latest version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @throws com.azure.core.management.exception.ManagementException 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 PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the prepared image specifications in a subscription at the latest version. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 PreparedImageSpecification list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version along with {@link Response}. + */ + Response getVersionWithResponse(String resourceGroupName, + String preparedImageSpecificationName, String version, Context context); + + /** + * Get a prepared image specification at a particular version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification resource. + * @param version The version of the Prepared Image Specification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a prepared image specification at a particular version. + */ + PreparedImageSpecificationVersion getVersion(String resourceGroupName, String preparedImageSpecificationName, + String version); + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName); + + /** + * List all versions of a prepared image specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param preparedImageSpecificationName The name of the Prepared Image Specification 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 PreparedImageSpecificationVersion list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listVersions(String resourceGroupName, + String preparedImageSpecificationName, Context context); + + /** + * Get a prepared image specification at the latest version. + * + * @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 prepared image specification at the latest version along with {@link Response}. + */ + PreparedImageSpecification getById(String id); + + /** + * Get a prepared image specification at the latest version. + * + * @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 prepared image specification at the latest version along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a prepared image specification. This operation will be blocked if the resource is in use. + * + * @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 prepared image specification. This operation will be blocked if the resource is in use. + * + * @param id the resource ID. + * @param ifMatch The request should only proceed if the targeted resource's etag matches the value provided. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String ifMatch, Context context); + + /** + * Begins definition for a new PreparedImageSpecification resource. + * + * @param name resource name. + * @return the first stage of the new PreparedImageSpecification definition. + */ + PreparedImageSpecification.DefinitionStages.Blank define(String name); +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ProvisioningState.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ProvisioningState.java new file mode 100644 index 000000000000..a87a79688af9 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the image customization. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Provisioning the resource is in progress. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Resource is being updated. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Resource is being deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * The change request has been accepted. + */ + 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ScriptType.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ScriptType.java new file mode 100644 index 000000000000..7b8e9c2461eb --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ScriptType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The script type. + */ +public final class ScriptType extends ExpandableStringEnum { + /** + * Bash script. + */ + public static final ScriptType BASH = fromString("Bash"); + + /** + * PowerShell script. + */ + public static final ScriptType POWER_SHELL = fromString("PowerShell"); + + /** + * Creates a new instance of ScriptType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScriptType() { + } + + /** + * Creates or finds a ScriptType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScriptType. + */ + public static ScriptType fromString(String name) { + return fromString(name, ScriptType.class); + } + + /** + * Gets known ScriptType values. + * + * @return known ScriptType values. + */ + public static Collection values() { + return values(ScriptType.class); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/package-info.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/package-info.java new file mode 100644 index 000000000000..099240d74809 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/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) TypeSpec Code Generator. + +/** + * Package containing the data models for ContainerServicePreparedImageSpecification. + * Azure Kubernetes Prepared Image Specification api client. + */ +package com.azure.resourcemanager.containerservicepreparedimgspec.models; diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/package-info.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/package-info.java new file mode 100644 index 000000000000..51c55dd6e241 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ContainerServicePreparedImageSpecification. + * Azure Kubernetes Prepared Image Specification api client. + */ +package com.azure.resourcemanager.containerservicepreparedimgspec; diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/module-info.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/module-info.java new file mode 100644 index 000000000000..b4509c03433c --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.containerservicepreparedimgspec { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.containerservicepreparedimgspec; + exports com.azure.resourcemanager.containerservicepreparedimgspec.fluent; + exports com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models; + exports com.azure.resourcemanager.containerservicepreparedimgspec.models; + + opens com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models to com.azure.core; + opens com.azure.resourcemanager.containerservicepreparedimgspec.models to com.azure.core; + opens com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models to com.azure.core; +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/azure-resourcemanager-containerservicepreparedimgspec_metadata.json b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/azure-resourcemanager-containerservicepreparedimgspec_metadata.json new file mode 100644 index 000000000000..c15a623499b7 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/azure-resourcemanager-containerservicepreparedimgspec_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.ContainerService":"2026-02-02-preview"},"crossLanguagePackageId":"Microsoft.ContainerService","crossLanguageVersion":"eac46e0dc03d","crossLanguageDefinitions":{"com.azure.resourcemanager.containerservicepreparedimgspec.fluent.OperationsClient":"Microsoft.ContainerService.Operations","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient":"Microsoft.ContainerService.PreparedImageSpecifications","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.beginCreateOrUpdate":"Microsoft.ContainerService.PreparedImageSpecifications.createOrUpdate","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.beginDelete":"Microsoft.ContainerService.PreparedImageSpecifications.delete","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.beginDeleteVersion":"Microsoft.ContainerService.PreparedImageSpecifications.deleteVersion","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.createOrUpdate":"Microsoft.ContainerService.PreparedImageSpecifications.createOrUpdate","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.delete":"Microsoft.ContainerService.PreparedImageSpecifications.delete","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.deleteVersion":"Microsoft.ContainerService.PreparedImageSpecifications.deleteVersion","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.getByResourceGroup":"Microsoft.ContainerService.PreparedImageSpecifications.get","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.getByResourceGroupWithResponse":"Microsoft.ContainerService.PreparedImageSpecifications.get","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.getVersion":"Microsoft.ContainerService.PreparedImageSpecifications.getVersion","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.getVersionWithResponse":"Microsoft.ContainerService.PreparedImageSpecifications.getVersion","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.list":"Microsoft.ContainerService.PreparedImageSpecifications.listBySubscription","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.listByResourceGroup":"Microsoft.ContainerService.PreparedImageSpecifications.listByResourceGroup","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.listVersions":"Microsoft.ContainerService.PreparedImageSpecifications.listVersions","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.update":"Microsoft.ContainerService.PreparedImageSpecifications.update","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImageSpecificationsClient.updateWithResponse":"Microsoft.ContainerService.PreparedImageSpecifications.update","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.PreparedImgSpecMgmtClient":"Microsoft.ContainerService","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner":"Microsoft.ContainerService.PreparedImageSpecification","com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner":"Microsoft.ContainerService.PreparedImageSpecificationVersion","com.azure.resourcemanager.containerservicepreparedimgspec.implementation.PreparedImgSpecMgmtClientBuilder":"Microsoft.ContainerService","com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.PreparedImageSpecificationListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.PreparedImageSpecificationVersionListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.containerservicepreparedimgspec.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint":"Microsoft.ContainerService.ExecutionPoint","com.azure.resourcemanager.containerservicepreparedimgspec.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.containerservicepreparedimgspec.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction":"Microsoft.ContainerService.PostScriptAction","com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile":"Microsoft.ContainerService.PreparedImageSpecificationManagedIdentityProfile","com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationPatch":"Microsoft.ContainerService.PreparedImageSpecificationPatch","com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties":"Microsoft.ContainerService.PreparedImageSpecificationProperties","com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript":"Microsoft.ContainerService.PreparedImageSpecificationScript","com.azure.resourcemanager.containerservicepreparedimgspec.models.ProvisioningState":"Microsoft.ContainerService.ProvisioningState","com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType":"Microsoft.ContainerService.ScriptType"},"generatedFiles":["src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/ContainerServicePreparedImageSpecificationManager.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImageSpecificationsClient.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/PreparedImgSpecMgmtClient.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationInner.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/PreparedImageSpecificationVersionInner.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/fluent/package-info.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationVersionImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsClientImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImageSpecificationsImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientBuilder.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/PreparedImgSpecMgmtClientImpl.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationListResult.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/models/PreparedImageSpecificationVersionListResult.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/implementation/package-info.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ActionType.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ExecutionPoint.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operation.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Operations.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/Origin.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PostScriptAction.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecification.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationManagedIdentityProfile.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationPatch.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationProperties.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationScript.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecificationVersion.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/PreparedImageSpecifications.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/ScriptType.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/models/package-info.java","src/main/java/com/azure/resourcemanager/containerservicepreparedimgspec/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/proxy-config.json b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/proxy-config.json new file mode 100644 index 000000000000..68cd3f89c28d --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.containerservicepreparedimgspec.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.containerservicepreparedimgspec.implementation.PreparedImageSpecificationsClientImpl$PreparedImageSpecificationsService"]] \ No newline at end of file diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/reflect-config.json b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/META-INF/native-image/com.azure.resourcemanager/containerservicepreparedimgspec/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/azure-resourcemanager-containerservicepreparedimgspec.properties b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/azure-resourcemanager-containerservicepreparedimgspec.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/main/resources/azure-resourcemanager-containerservicepreparedimgspec.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListSamples.java new file mode 100644 index 000000000000..17ba5e3dfd3f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-02-02-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void operationsList( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrSamples.java new file mode 100644 index 000000000000..bed2292d0e61 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PreparedImageSpecifications CreateOrUpdate. + */ +public final class PreparedImageSpecificationsCreateOrSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_CreateOrUpdate.json + */ + /** + * Sample code: PreparedImageSpecifications_CreateOrUpdate. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsCreateOrUpdate( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .define("my-prepared-image-specification") + .withRegion("westus2") + .withExistingResourceGroup("rg1") + .withTags(mapOf("team", "blue")) + .withProperties(new PreparedImageSpecificationProperties().withContainerImages(Arrays.asList("redis:8.0.0")) + .withIdentityProfile(new PreparedImageSpecificationManagedIdentityProfile().withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1")) + .withVersion("20250101-abcd1234") + .withCustomizationScripts(Arrays.asList(new PreparedImageSpecificationScript() + .withName("initialize-node") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.BASH) + .withScript("echo \"test prepared image specification\" > /var/log/test-node-customization.txt")))) + .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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteSamples.java new file mode 100644 index 000000000000..b548127ed7a5 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications Delete. + */ +public final class PreparedImageSpecificationsDeleteSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_Delete.json + */ + /** + * Sample code: PreparedImageSpecifications_Delete. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsDelete( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .delete("rg1", "my-prepared-image-specification", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteVeSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteVeSamples.java new file mode 100644 index 000000000000..c29d66164367 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsDeleteVeSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications DeleteVersion. + */ +public final class PreparedImageSpecificationsDeleteVeSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_DeleteVersion.json + */ + /** + * Sample code: PreparedImageSpecifications_DeleteVersion. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsDeleteVersion( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .deleteVersion("rg1", "my-prepared-image-specification", "20250101-abcd1234", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResSamples.java new file mode 100644 index 000000000000..e0b208939a43 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications GetByResourceGroup. + */ +public final class PreparedImageSpecificationsGetByResSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_Get.json + */ + /** + * Sample code: PreparedImageSpecifications_Get. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsGet( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .getByResourceGroupWithResponse("rg1", "my-prepared-image-specification", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersiSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersiSamples.java new file mode 100644 index 000000000000..089d63c7d8a2 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersiSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications GetVersion. + */ +public final class PreparedImageSpecificationsGetVersiSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_GetVersion.json + */ + /** + * Sample code: PreparedImageSpecifications_GetVersion. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsGetVersion( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .getVersionWithResponse("rg1", "my-prepared-image-specification", "20250101-abcd1234", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByReSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByReSamples.java new file mode 100644 index 000000000000..01dffb31352c --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByReSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications ListByResourceGroup. + */ +public final class PreparedImageSpecificationsListByReSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_ListByResourceGroup.json + */ + /** + * Sample code: PreparedImageSpecifications_ListByResourceGroup. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsListByResourceGroup( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications().listByResourceGroup("rg1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListSamples.java new file mode 100644 index 000000000000..dacab7314b9f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications List. + */ +public final class PreparedImageSpecificationsListSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_ListBySubscription.json + */ + /** + * Sample code: PreparedImageSpecifications_ListBySubscription. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsListBySubscription( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersSamples.java new file mode 100644 index 000000000000..19af0e1392f7 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +/** + * Samples for PreparedImageSpecifications ListVersions. + */ +public final class PreparedImageSpecificationsListVersSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_ListVersions.json + */ + /** + * Sample code: PreparedImageSpecifications_ListVersions. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsListVersions( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + manager.preparedImageSpecifications() + .listVersions("rg1", "my-prepared-image-specification", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsUpdateSamples.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsUpdateSamples.java new file mode 100644 index 000000000000..bc843c23bce4 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/samples/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PreparedImageSpecifications Update. + */ +public final class PreparedImageSpecificationsUpdateSamples { + /* + * x-ms-original-file: 2026-02-02-preview/PreparedImageSpecifications_Update.json + */ + /** + * Sample code: PreparedImageSpecifications_Update. + * + * @param manager Entry point to ContainerServicePreparedImageSpecificationManager. + */ + public static void preparedImageSpecificationsUpdate( + com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager manager) { + PreparedImageSpecification resource = manager.preparedImageSpecifications() + .getByResourceGroupWithResponse("rg1", "my-prepared-image-specification", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key5558", "fakeTokenPlaceholder")).apply(); + } + + // 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationDisplayTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..adb4bdc2390c --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationInnerTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationInnerTests.java new file mode 100644 index 000000000000..73a300c601b5 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationListResultTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationListResultTests.java new file mode 100644 index 000000000000..87f9147c5ec1 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..889f8754bebd --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/OperationsListMockTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"aos\",\"isDataAction\":false,\"display\":{\"provider\":\"onpc\",\"resource\":\"ocohslkevleg\",\"operation\":\"fbuhfmvfaxkffe\",\"description\":\"th\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationInnerTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationInnerTests.java new file mode 100644 index 000000000000..c5b808d48322 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationInnerTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationInner model = BinaryData.fromString( + "{\"properties\":{\"containerImages\":[\"bpzvgn\",\"zsymglzufcyzkohd\",\"ihanuf\",\"fcbjysagithxqha\"],\"identityProfile\":{\"resourceId\":\"fpikxwczb\",\"objectId\":\"cnpqxuhivyqniwby\",\"clientId\":\"k\"},\"version\":\"dumjgrtfwvuk\",\"provisioningState\":\"Accepted\",\"customizationScripts\":[{\"name\":\"ccsnhsjc\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"hkryhtn\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"wlokjyem\",\"location\":\"vnipjox\",\"tags\":{\"ilzyd\":\"chgejspodm\",\"jwyahuxinpmqnja\":\"h\"},\"id\":\"wixjsprozvcp\",\"name\":\"tegjvwmf\",\"type\":\"atscmd\"}") + .toObject(PreparedImageSpecificationInner.class); + Assertions.assertEquals("vnipjox", model.location()); + Assertions.assertEquals("chgejspodm", model.tags().get("ilzyd")); + Assertions.assertEquals("bpzvgn", model.properties().containerImages().get(0)); + Assertions.assertEquals("fpikxwczb", model.properties().identityProfile().resourceId()); + Assertions.assertEquals("dumjgrtfwvuk", model.properties().version()); + Assertions.assertEquals("ccsnhsjc", model.properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + model.properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, model.properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("hkryhtn", model.properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + model.properties().customizationScripts().get(0).postScriptAction()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PreparedImageSpecificationInner model = new PreparedImageSpecificationInner().withLocation("vnipjox") + .withTags(mapOf("ilzyd", "chgejspodm", "jwyahuxinpmqnja", "h")) + .withProperties(new PreparedImageSpecificationProperties() + .withContainerImages(Arrays.asList("bpzvgn", "zsymglzufcyzkohd", "ihanuf", "fcbjysagithxqha")) + .withIdentityProfile(new PreparedImageSpecificationManagedIdentityProfile().withResourceId("fpikxwczb")) + .withVersion("dumjgrtfwvuk") + .withCustomizationScripts(Arrays.asList(new PreparedImageSpecificationScript().withName("ccsnhsjc") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.BASH) + .withScript("hkryhtn") + .withPostScriptAction(PostScriptAction.REBOOT_AFTER)))); + model = BinaryData.fromObject(model).toObject(PreparedImageSpecificationInner.class); + Assertions.assertEquals("vnipjox", model.location()); + Assertions.assertEquals("chgejspodm", model.tags().get("ilzyd")); + Assertions.assertEquals("bpzvgn", model.properties().containerImages().get(0)); + Assertions.assertEquals("fpikxwczb", model.properties().identityProfile().resourceId()); + Assertions.assertEquals("dumjgrtfwvuk", model.properties().version()); + Assertions.assertEquals("ccsnhsjc", model.properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + model.properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, model.properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("hkryhtn", model.properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + model.properties().customizationScripts().get(0).postScriptAction()); + } + + // 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationListResultTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationListResultTests.java new file mode 100644 index 000000000000..d462e3eef90f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationListResultTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.PreparedImageSpecificationListResult; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"containerImages\":[\"v\"],\"identityProfile\":{\"resourceId\":\"mjqulngsn\",\"objectId\":\"bybkzgcwrwclxx\",\"clientId\":\"ljdousk\"},\"version\":\"vkocrcjdkwtn\",\"provisioningState\":\"Updating\",\"customizationScripts\":[{\"name\":\"biksq\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"sainqpjwnzl\",\"postScriptAction\":\"None\"},{\"name\":\"mppeebvmgxs\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"qduujitcjczdz\",\"postScriptAction\":\"None\"},{\"name\":\"dhkrwpdappdsbdk\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"jfeusnh\",\"postScriptAction\":\"None\"},{\"name\":\"eltmrldhugjzzdat\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"cdgea\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"huticndvkao\",\"location\":\"yiftyhxhuro\",\"tags\":{\"cukjf\":\"yxolniwp\",\"lryplwckbasyy\":\"giawx\",\"jkot\":\"nddhsgcbacph\"},\"id\":\"nqgoulzndli\",\"name\":\"wyqkgfgibm\",\"type\":\"dgak\"},{\"properties\":{\"containerImages\":[\"xybz\",\"qedqytbciqfoufl\"],\"identityProfile\":{\"resourceId\":\"nkzsmodmglou\",\"objectId\":\"b\",\"clientId\":\"tmut\"},\"version\":\"qktapspwgcuert\",\"provisioningState\":\"Succeeded\",\"customizationScripts\":[{\"name\":\"svqwhbmdgbbjfd\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"mbe\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"htqqrolfp\",\"location\":\"s\",\"tags\":{\"gzjaoyfhrtxilne\":\"bquxigjy\",\"wrlyxwjkcprb\":\"kujysvlejuvfq\"},\"id\":\"wbxgjvt\",\"name\":\"vpys\",\"type\":\"zdn\"},{\"properties\":{\"containerImages\":[\"guhmuouqfpr\",\"zw\"],\"identityProfile\":{\"resourceId\":\"g\",\"objectId\":\"tnwu\",\"clientId\":\"gazxuf\"},\"version\":\"uckyf\",\"provisioningState\":\"Deleting\",\"customizationScripts\":[{\"name\":\"dfvzwdzuhty\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"dkfthwxmnt\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"opvkmijcm\",\"location\":\"dcuf\",\"tags\":{\"xtbzsgfyccsne\":\"rpymzidnsez\"},\"id\":\"mdwzjeiachboo\",\"name\":\"flnrosfqpteehzz\",\"type\":\"ypyqrimzinp\"},{\"properties\":{\"containerImages\":[\"dkirsoodqxhcr\",\"nohjt\",\"kwh\"],\"identityProfile\":{\"resourceId\":\"oifiyipjxsqwpgr\",\"objectId\":\"znorcj\",\"clientId\":\"snb\"},\"version\":\"qabnmoc\",\"provisioningState\":\"Canceled\",\"customizationScripts\":[{\"name\":\"urzafb\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"pbtoqcjmkl\",\"postScriptAction\":\"None\"},{\"name\":\"bqidtqaj\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"pku\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"rlkhbzhfepgzgq\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"ocxscpaierhhbcs\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"majtjaod\",\"location\":\"bnbdxkqpxokajion\",\"tags\":{\"stxgc\":\"ex\",\"lovmclwhijcoe\":\"odgmaajrmvdjwz\",\"qsycbkbfkgu\":\"ctbzaq\"},\"id\":\"dkexxppofm\",\"name\":\"axcfjpgddtocjjx\",\"type\":\"vpmouexhdzxib\"}],\"nextLink\":\"ojnxqbzvdd\"}") + .toObject(PreparedImageSpecificationListResult.class); + Assertions.assertEquals("yiftyhxhuro", model.value().get(0).location()); + Assertions.assertEquals("yxolniwp", model.value().get(0).tags().get("cukjf")); + Assertions.assertEquals("v", model.value().get(0).properties().containerImages().get(0)); + Assertions.assertEquals("mjqulngsn", model.value().get(0).properties().identityProfile().resourceId()); + Assertions.assertEquals("vkocrcjdkwtn", model.value().get(0).properties().version()); + Assertions.assertEquals("biksq", model.value().get(0).properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + model.value().get(0).properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, + model.value().get(0).properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("sainqpjwnzl", + model.value().get(0).properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.NONE, + model.value().get(0).properties().customizationScripts().get(0).postScriptAction()); + Assertions.assertEquals("ojnxqbzvdd", model.nextLink()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationManagedIdentitTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationManagedIdentitTests.java new file mode 100644 index 000000000000..c43ffd72ff8f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationManagedIdentitTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationManagedIdentitTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationManagedIdentityProfile model = BinaryData + .fromString("{\"resourceId\":\"epoo\",\"objectId\":\"nuvamiheogna\",\"clientId\":\"zxtheotusivyevcc\"}") + .toObject(PreparedImageSpecificationManagedIdentityProfile.class); + Assertions.assertEquals("epoo", model.resourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PreparedImageSpecificationManagedIdentityProfile model + = new PreparedImageSpecificationManagedIdentityProfile().withResourceId("epoo"); + model = BinaryData.fromObject(model).toObject(PreparedImageSpecificationManagedIdentityProfile.class); + Assertions.assertEquals("epoo", model.resourceId()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPatchTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPatchTests.java new file mode 100644 index 000000000000..78f0258c6cb0 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPatchTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationPatch; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationPatchTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationPatch model + = BinaryData.fromString("{\"tags\":{\"ljofxqeofjaeqjh\":\"xgispemvtzfkufu\"}}") + .toObject(PreparedImageSpecificationPatch.class); + Assertions.assertEquals("xgispemvtzfkufu", model.tags().get("ljofxqeofjaeqjh")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PreparedImageSpecificationPatch model + = new PreparedImageSpecificationPatch().withTags(mapOf("ljofxqeofjaeqjh", "xgispemvtzfkufu")); + model = BinaryData.fromObject(model).toObject(PreparedImageSpecificationPatch.class); + Assertions.assertEquals("xgispemvtzfkufu", model.tags().get("ljofxqeofjaeqjh")); + } + + // 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPropertiesTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPropertiesTests.java new file mode 100644 index 000000000000..e06aebcb7d3d --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationPropertiesTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationProperties model = BinaryData.fromString( + "{\"containerImages\":[\"hulsuuvmkjozkrwf\",\"dio\",\"jpslwejd\"],\"identityProfile\":{\"resourceId\":\"wryoqpsoacc\",\"objectId\":\"zakljlahbc\",\"clientId\":\"ffdfdosygexpa\"},\"version\":\"akhmsbzjhcrz\",\"provisioningState\":\"Deleting\",\"customizationScripts\":[{\"name\":\"lxaolthqtrgqjbp\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"inzgvfcj\",\"postScriptAction\":\"None\"},{\"name\":\"oxxjtfelluwf\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"np\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"pjkjlxofpdv\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"xypininmayhuybbk\",\"postScriptAction\":\"None\"}]}") + .toObject(PreparedImageSpecificationProperties.class); + Assertions.assertEquals("hulsuuvmkjozkrwf", model.containerImages().get(0)); + Assertions.assertEquals("wryoqpsoacc", model.identityProfile().resourceId()); + Assertions.assertEquals("akhmsbzjhcrz", model.version()); + Assertions.assertEquals("lxaolthqtrgqjbp", model.customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_PROVISION_TIME, + model.customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, model.customizationScripts().get(0).scriptType()); + Assertions.assertEquals("inzgvfcj", model.customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.NONE, model.customizationScripts().get(0).postScriptAction()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PreparedImageSpecificationProperties model = new PreparedImageSpecificationProperties() + .withContainerImages(Arrays.asList("hulsuuvmkjozkrwf", "dio", "jpslwejd")) + .withIdentityProfile(new PreparedImageSpecificationManagedIdentityProfile().withResourceId("wryoqpsoacc")) + .withVersion("akhmsbzjhcrz") + .withCustomizationScripts(Arrays.asList( + new PreparedImageSpecificationScript().withName("lxaolthqtrgqjbp") + .withExecutionPoint(ExecutionPoint.NODE_PROVISION_TIME) + .withScriptType(ScriptType.POWER_SHELL) + .withScript("inzgvfcj") + .withPostScriptAction(PostScriptAction.NONE), + new PreparedImageSpecificationScript().withName("oxxjtfelluwf") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.BASH) + .withScript("np") + .withPostScriptAction(PostScriptAction.REBOOT_AFTER), + new PreparedImageSpecificationScript().withName("pjkjlxofpdv") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.POWER_SHELL) + .withScript("xypininmayhuybbk") + .withPostScriptAction(PostScriptAction.NONE))); + model = BinaryData.fromObject(model).toObject(PreparedImageSpecificationProperties.class); + Assertions.assertEquals("hulsuuvmkjozkrwf", model.containerImages().get(0)); + Assertions.assertEquals("wryoqpsoacc", model.identityProfile().resourceId()); + Assertions.assertEquals("akhmsbzjhcrz", model.version()); + Assertions.assertEquals("lxaolthqtrgqjbp", model.customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_PROVISION_TIME, + model.customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, model.customizationScripts().get(0).scriptType()); + Assertions.assertEquals("inzgvfcj", model.customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.NONE, model.customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationScriptTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationScriptTests.java new file mode 100644 index 000000000000..ad462eb0daaf --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationScriptTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationScriptTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationScript model = BinaryData.fromString( + "{\"name\":\"qi\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"ngbwjz\",\"postScriptAction\":\"RebootAfter\"}") + .toObject(PreparedImageSpecificationScript.class); + Assertions.assertEquals("qi", model.name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, model.executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, model.scriptType()); + Assertions.assertEquals("ngbwjz", model.script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, model.postScriptAction()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PreparedImageSpecificationScript model = new PreparedImageSpecificationScript().withName("qi") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.POWER_SHELL) + .withScript("ngbwjz") + .withPostScriptAction(PostScriptAction.REBOOT_AFTER); + model = BinaryData.fromObject(model).toObject(PreparedImageSpecificationScript.class); + Assertions.assertEquals("qi", model.name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, model.executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, model.scriptType()); + Assertions.assertEquals("ngbwjz", model.script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, model.postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionInnerTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionInnerTests.java new file mode 100644 index 000000000000..02bc915b031b --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionInnerTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.fluent.models.PreparedImageSpecificationVersionInner; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationVersionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationVersionInner model = BinaryData.fromString( + "{\"properties\":{\"containerImages\":[\"deicbtwnpzao\"],\"identityProfile\":{\"resourceId\":\"uhrhcffcyddgl\",\"objectId\":\"t\",\"clientId\":\"qkwpyeicxmqc\"},\"version\":\"q\",\"provisioningState\":\"Provisioning\",\"customizationScripts\":[{\"name\":\"xuigdtopbobj\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"e\",\"postScriptAction\":\"None\"},{\"name\":\"m\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"z\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"vtpgvdfgiotkf\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"xlngx\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"gug\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"xdqmidtthzrvqdra\",\"postScriptAction\":\"None\"}]},\"id\":\"big\",\"name\":\"h\",\"type\":\"qfbow\"}") + .toObject(PreparedImageSpecificationVersionInner.class); + Assertions.assertEquals("deicbtwnpzao", model.properties().containerImages().get(0)); + Assertions.assertEquals("uhrhcffcyddgl", model.properties().identityProfile().resourceId()); + Assertions.assertEquals("q", model.properties().version()); + Assertions.assertEquals("xuigdtopbobj", model.properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + model.properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, model.properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("e", model.properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.NONE, + model.properties().customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionListResTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionListResTests.java new file mode 100644 index 000000000000..f615a250c5b2 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationVersionListResTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicepreparedimgspec.implementation.models.PreparedImageSpecificationVersionListResult; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import org.junit.jupiter.api.Assertions; + +public final class PreparedImageSpecificationVersionListResTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PreparedImageSpecificationVersionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"containerImages\":[\"ktzlcuiywg\"],\"identityProfile\":{\"resourceId\":\"wgndrvynhzgpp\",\"objectId\":\"cgyncocpecf\",\"clientId\":\"mcoo\"},\"version\":\"xlzevgbmqjqabcy\",\"provisioningState\":\"Canceled\",\"customizationScripts\":[{\"name\":\"w\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"ccfwnfnbacfion\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"x\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"tzxdpnqbqqwx\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"eallnwsubisnj\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"ngnzscxaqwoochc\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"qvpkvlrxnjeaseip\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"lokeyy\",\"postScriptAction\":\"None\"}]},\"id\":\"bdlwtgrhpdjpj\",\"name\":\"masxazjpqyegu\",\"type\":\"lhbxxhejjzzvdud\"},{\"properties\":{\"containerImages\":[\"lfh\",\"twmcynpwlb\"],\"identityProfile\":{\"resourceId\":\"pgacftadehxnlty\",\"objectId\":\"oppusuesnzw\",\"clientId\":\"jbavorxzdm\"},\"version\":\"ctbqvudwx\",\"provisioningState\":\"Succeeded\",\"customizationScripts\":[{\"name\":\"owgujjugwdkcglhs\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"dyggdtjixhbku\",\"postScriptAction\":\"RebootAfter\"}]},\"id\":\"e\",\"name\":\"kh\",\"type\":\"enevfyexfwhybci\"},{\"properties\":{\"containerImages\":[\"dcsi\",\"ynnaam\",\"ectehf\"],\"identityProfile\":{\"resourceId\":\"scjeypv\",\"objectId\":\"zrkgqhcjrefovg\",\"clientId\":\"qsl\"},\"version\":\"yvxyqjp\",\"provisioningState\":\"Failed\",\"customizationScripts\":[{\"name\":\"pngjcrcczsqpjhvm\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"nysounqe\",\"postScriptAction\":\"None\"},{\"name\":\"oaeupfhyhltrpmo\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"matuok\",\"postScriptAction\":\"None\"},{\"name\":\"uiuaodsfcpkvxodp\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"yzydagfuaxbezyi\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"ktwh\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"zywqsmbsu\",\"postScriptAction\":\"None\"}]},\"id\":\"moryocfsfksym\",\"name\":\"dystkiiuxhqyud\",\"type\":\"o\"},{\"properties\":{\"containerImages\":[\"b\",\"oczvy\",\"fqrvkdvjsllrmvvd\",\"watkpnpulexxb\"],\"identityProfile\":{\"resourceId\":\"wtruwiqzbqjvsovm\",\"objectId\":\"kacspkw\",\"clientId\":\"zdobpxjmflbvvnch\"},\"version\":\"cciw\",\"provisioningState\":\"Canceled\",\"customizationScripts\":[{\"name\":\"khrs\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"ku\",\"postScriptAction\":\"None\"}]},\"id\":\"kg\",\"name\":\"sauuimj\",\"type\":\"vxieduugidyj\"}],\"nextLink\":\"f\"}") + .toObject(PreparedImageSpecificationVersionListResult.class); + Assertions.assertEquals("ktzlcuiywg", model.value().get(0).properties().containerImages().get(0)); + Assertions.assertEquals("wgndrvynhzgpp", model.value().get(0).properties().identityProfile().resourceId()); + Assertions.assertEquals("xlzevgbmqjqabcy", model.value().get(0).properties().version()); + Assertions.assertEquals("w", model.value().get(0).properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_PROVISION_TIME, + model.value().get(0).properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, + model.value().get(0).properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("ccfwnfnbacfion", + model.value().get(0).properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + model.value().get(0).properties().customizationScripts().get(0).postScriptAction()); + Assertions.assertEquals("f", model.nextLink()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrUMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrUMockTests.java new file mode 100644 index 000000000000..eae7f5969c27 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsCreateOrUMockTests.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationManagedIdentityProfile; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationProperties; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationScript; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PreparedImageSpecificationsCreateOrUMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"containerImages\":[\"gicjooxdjeb\",\"pucwwfvovbvme\",\"ecivyh\",\"ce\"],\"identityProfile\":{\"resourceId\":\"jgjrwjueiotwm\",\"objectId\":\"ytdxwit\",\"clientId\":\"rjaw\"},\"version\":\"wgxhn\",\"provisioningState\":\"Succeeded\",\"customizationScripts\":[{\"name\":\"bkpyc\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"Bash\",\"script\":\"ndnhj\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"hvylwzbt\",\"location\":\"xujznbmpowu\",\"tags\":{\"obbc\":\"zqlveualupjmkhf\",\"tghfgblcgwxzvl\":\"wsrtjriplrbpbe\"},\"id\":\"qhjk\",\"name\":\"egibtnmxiebww\",\"type\":\"loayqcgw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PreparedImageSpecification response = manager.preparedImageSpecifications() + .define("g") + .withRegion("quhcdhmduala") + .withExistingResourceGroup("tcc") + .withTags(mapOf("vxpvgomz", "pvfadmwsrcr")) + .withProperties(new PreparedImageSpecificationProperties() + .withContainerImages(Arrays.asList("ytlmoyrxvwfud")) + .withIdentityProfile(new PreparedImageSpecificationManagedIdentityProfile().withResourceId("zntxhdz")) + .withVersion("z") + .withCustomizationScripts(Arrays.asList( + new PreparedImageSpecificationScript().withName("fkuwbcrnwbmehhse") + .withExecutionPoint(ExecutionPoint.NODE_IMAGE_BUILD_TIME) + .withScriptType(ScriptType.POWER_SHELL) + .withScript("srtslhspkdeem") + .withPostScriptAction(PostScriptAction.NONE), + new PreparedImageSpecificationScript().withName("mx") + .withExecutionPoint(ExecutionPoint.NODE_PROVISION_TIME) + .withScriptType(ScriptType.BASH) + .withScript("t") + .withPostScriptAction(PostScriptAction.REBOOT_AFTER)))) + .withIfMatch("urqhaka") + .withIfNoneMatch("hashsfwxosow") + .create(); + + Assertions.assertEquals("xujznbmpowu", response.location()); + Assertions.assertEquals("zqlveualupjmkhf", response.tags().get("obbc")); + Assertions.assertEquals("gicjooxdjeb", response.properties().containerImages().get(0)); + Assertions.assertEquals("jgjrwjueiotwm", response.properties().identityProfile().resourceId()); + Assertions.assertEquals("wgxhn", response.properties().version()); + Assertions.assertEquals("bkpyc", response.properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_PROVISION_TIME, + response.properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, response.properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("ndnhj", response.properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + response.properties().customizationScripts().get(0).postScriptAction()); + } + + // 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/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResoMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResoMockTests.java new file mode 100644 index 000000000000..64509359711a --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetByResoMockTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PreparedImageSpecificationsGetByResoMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"containerImages\":[\"ur\",\"jx\",\"jnspydp\"],\"identityProfile\":{\"resourceId\":\"oenkouknvudwti\",\"objectId\":\"bldngkpoc\",\"clientId\":\"azyxoegukg\"},\"version\":\"piu\",\"provisioningState\":\"Succeeded\",\"customizationScripts\":[{\"name\":\"vqzntypmrbpizcdr\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"pyd\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"hxdeoejz\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"fsj\",\"postScriptAction\":\"RebootAfter\"},{\"name\":\"zfbishcbkhaj\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"a\",\"postScriptAction\":\"None\"}]},\"eTag\":\"agalpbuxwgipwhon\",\"location\":\"kgshwa\",\"tags\":{\"rywn\":\"xzbinjeputt\",\"lwh\":\"zoqftiyqzrnkcqvy\",\"ryavwhheunmmqh\":\"lsicohoqqnwv\",\"noc\":\"yxzk\"},\"id\":\"koklya\",\"name\":\"uconuqszfkbey\",\"type\":\"ewrmjmwvvjektc\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PreparedImageSpecification response = manager.preparedImageSpecifications() + .getByResourceGroupWithResponse("yvshxmz", "bbzoggig", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("kgshwa", response.location()); + Assertions.assertEquals("xzbinjeputt", response.tags().get("rywn")); + Assertions.assertEquals("ur", response.properties().containerImages().get(0)); + Assertions.assertEquals("oenkouknvudwti", response.properties().identityProfile().resourceId()); + Assertions.assertEquals("piu", response.properties().version()); + Assertions.assertEquals("vqzntypmrbpizcdr", response.properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + response.properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, + response.properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("pyd", response.properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + response.properties().customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersioMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersioMockTests.java new file mode 100644 index 000000000000..a9c7460e850f --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsGetVersioMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationVersion; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PreparedImageSpecificationsGetVersioMockTests { + @Test + public void testGetVersionWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"containerImages\":[\"pfza\",\"glcuhxwtctyqi\",\"lbbovplw\"],\"identityProfile\":{\"resourceId\":\"hvgyuguosvmk\",\"objectId\":\"sxqu\",\"clientId\":\"fpl\"},\"version\":\"gsxnkjzkdeslpv\",\"provisioningState\":\"Failed\",\"customizationScripts\":[{\"name\":\"yighxpk\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"aiuebbaumnyqu\",\"postScriptAction\":\"None\"}]},\"id\":\"ojnabckhsmtxpsie\",\"name\":\"tfhvpesapskrdqmh\",\"type\":\"jdhtldwkyzxu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PreparedImageSpecificationVersion response = manager.preparedImageSpecifications() + .getVersionWithResponse("hdwbavxbniwdjs", "zt", "dbpgnxytxhp", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("pfza", response.properties().containerImages().get(0)); + Assertions.assertEquals("hvgyuguosvmk", response.properties().identityProfile().resourceId()); + Assertions.assertEquals("gsxnkjzkdeslpv", response.properties().version()); + Assertions.assertEquals("yighxpk", response.properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + response.properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, response.properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("aiuebbaumnyqu", response.properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.NONE, + response.properties().customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByResMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByResMockTests.java new file mode 100644 index 000000000000..0f608706fb68 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListByResMockTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PreparedImageSpecificationsListByResMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"containerImages\":[\"pwvlqdq\"],\"identityProfile\":{\"resourceId\":\"iqylihkaetck\",\"objectId\":\"fcivfsnkym\",\"clientId\":\"tqhjfbebrjcx\"},\"version\":\"fuwutttxf\",\"provisioningState\":\"Failed\",\"customizationScripts\":[{\"name\":\"rp\",\"executionPoint\":\"NodeProvisionTime\",\"scriptType\":\"PowerShell\",\"script\":\"c\",\"postScriptAction\":\"None\"}]},\"eTag\":\"fnljky\",\"location\":\"j\",\"tags\":{\"gidokgjljyoxgvcl\":\"j\",\"jhtxfvgxbfsmxne\":\"bgsncghkjeszzhb\"},\"id\":\"mpvecxgodebfqk\",\"name\":\"rbmpukgri\",\"type\":\"flz\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.preparedImageSpecifications().listByResourceGroup("senhwlrs", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("j", response.iterator().next().location()); + Assertions.assertEquals("j", response.iterator().next().tags().get("gidokgjljyoxgvcl")); + Assertions.assertEquals("pwvlqdq", response.iterator().next().properties().containerImages().get(0)); + Assertions.assertEquals("iqylihkaetck", response.iterator().next().properties().identityProfile().resourceId()); + Assertions.assertEquals("fuwutttxf", response.iterator().next().properties().version()); + Assertions.assertEquals("rp", response.iterator().next().properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_PROVISION_TIME, + response.iterator().next().properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, + response.iterator().next().properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("c", response.iterator().next().properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.NONE, + response.iterator().next().properties().customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListMockTests.java new file mode 100644 index 000000000000..ff1f6e333d59 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListMockTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecification; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PreparedImageSpecificationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"containerImages\":[\"zpuzycisp\",\"qzahmgkbrp\",\"y\"],\"identityProfile\":{\"resourceId\":\"ibnuqqkpik\",\"objectId\":\"rgvtqag\",\"clientId\":\"uynhijg\"},\"version\":\"ebf\",\"provisioningState\":\"Updating\",\"customizationScripts\":[{\"name\":\"utrc\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"Bash\",\"script\":\"zzmhjrunmpxttd\",\"postScriptAction\":\"RebootAfter\"}]},\"eTag\":\"nlankxmyskpb\",\"location\":\"nbtkcxywnytnr\",\"tags\":{\"czfc\":\"lqidyby\",\"rqlfktsthsucocmn\":\"haaxdbabphl\",\"ckzywbiexzfeyue\":\"yazttbtwwrqpue\"},\"id\":\"xibxujwbhqwalm\",\"name\":\"zyoxaepdkzjan\",\"type\":\"ux\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.preparedImageSpecifications().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nbtkcxywnytnr", response.iterator().next().location()); + Assertions.assertEquals("lqidyby", response.iterator().next().tags().get("czfc")); + Assertions.assertEquals("zpuzycisp", response.iterator().next().properties().containerImages().get(0)); + Assertions.assertEquals("ibnuqqkpik", response.iterator().next().properties().identityProfile().resourceId()); + Assertions.assertEquals("ebf", response.iterator().next().properties().version()); + Assertions.assertEquals("utrc", response.iterator().next().properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + response.iterator().next().properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.BASH, + response.iterator().next().properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("zzmhjrunmpxttd", + response.iterator().next().properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + response.iterator().next().properties().customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersiMockTests.java b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersiMockTests.java new file mode 100644 index 000000000000..41e1615af4a0 --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/src/test/java/com/azure/resourcemanager/containerservicepreparedimgspec/generated/PreparedImageSpecificationsListVersiMockTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerservicepreparedimgspec.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerservicepreparedimgspec.ContainerServicePreparedImageSpecificationManager; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ExecutionPoint; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PostScriptAction; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.PreparedImageSpecificationVersion; +import com.azure.resourcemanager.containerservicepreparedimgspec.models.ScriptType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PreparedImageSpecificationsListVersiMockTests { + @Test + public void testListVersions() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"containerImages\":[\"nmic\"],\"identityProfile\":{\"resourceId\":\"vce\",\"objectId\":\"eil\",\"clientId\":\"notyfjfcnjbkcn\"},\"version\":\"hbttkphyw\",\"provisioningState\":\"Updating\",\"customizationScripts\":[{\"name\":\"oqnermclfpl\",\"executionPoint\":\"NodeImageBuildTime\",\"scriptType\":\"PowerShell\",\"script\":\"uscrpabgyepsb\",\"postScriptAction\":\"RebootAfter\"}]},\"id\":\"qugxywpmueefjzwf\",\"name\":\"kqujidsuyono\",\"type\":\"glaocq\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerServicePreparedImageSpecificationManager manager + = ContainerServicePreparedImageSpecificationManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.preparedImageSpecifications() + .listVersions("tkncwsc", "svlxotogtwrup", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nmic", response.iterator().next().properties().containerImages().get(0)); + Assertions.assertEquals("vce", response.iterator().next().properties().identityProfile().resourceId()); + Assertions.assertEquals("hbttkphyw", response.iterator().next().properties().version()); + Assertions.assertEquals("oqnermclfpl", + response.iterator().next().properties().customizationScripts().get(0).name()); + Assertions.assertEquals(ExecutionPoint.NODE_IMAGE_BUILD_TIME, + response.iterator().next().properties().customizationScripts().get(0).executionPoint()); + Assertions.assertEquals(ScriptType.POWER_SHELL, + response.iterator().next().properties().customizationScripts().get(0).scriptType()); + Assertions.assertEquals("uscrpabgyepsb", + response.iterator().next().properties().customizationScripts().get(0).script()); + Assertions.assertEquals(PostScriptAction.REBOOT_AFTER, + response.iterator().next().properties().customizationScripts().get(0).postScriptAction()); + } +} diff --git a/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/tsp-location.yaml b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/tsp-location.yaml new file mode 100644 index 000000000000..56362c5c1c9c --- /dev/null +++ b/sdk/containerservice/azure-resourcemanager-containerservicepreparedimgspec/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/containerservice/resource-manager/Microsoft.ContainerService/preparedimagespecification +commit: 6febc0e86632c12f81e22bd07e604d480b38481e +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/containerservice/ci.yml b/sdk/containerservice/ci.yml index f3a1d6f479c9..f0c69ddb464f 100644 --- a/sdk/containerservice/ci.yml +++ b/sdk/containerservice/ci.yml @@ -26,10 +26,14 @@ pr: - sdk/containerservice/pom.xml parameters: -- name: release_azureresourcemanagercontainerservice - displayName: 'azure-resourcemanager-containerservice' - type: boolean - default: false + - name: release_azureresourcemanagercontainerservice + displayName: azure-resourcemanager-containerservice + type: boolean + default: false + - name: release_azureresourcemanagercontainerservicepreparedimgspec + displayName: azure-resourcemanager-containerservicepreparedimgspec + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -40,3 +44,7 @@ extends: groupId: com.azure.resourcemanager safeName: azureresourcemanagercontainerservice releaseInBatch: ${{ parameters.release_azureresourcemanagercontainerservice }} + - name: azure-resourcemanager-containerservicepreparedimgspec + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercontainerservicepreparedimgspec + releaseInBatch: ${{ parameters.release_azureresourcemanagercontainerservicepreparedimgspec }} diff --git a/sdk/containerservice/pom.xml b/sdk/containerservice/pom.xml index 08ccb7890864..4ffd82e2ded5 100644 --- a/sdk/containerservice/pom.xml +++ b/sdk/containerservice/pom.xml @@ -10,5 +10,6 @@ 1.0.0 azure-resourcemanager-containerservice + azure-resourcemanager-containerservicepreparedimgspec