diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2a5d73fede62..33b6afee4f39 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -534,6 +534,7 @@ com.azure.resourcemanager:azure-resourcemanager-monitor-workspaces;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-programenrollment;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-resiliencemanagement;1.0.0-beta.1;1.0.0-beta.2 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.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/pom.xml b/pom.xml index d98072aaed6b..77eab817ee89 100644 --- a/pom.xml +++ b/pom.xml @@ -53,6 +53,7 @@ sdk/cognitiveservices sdk/commerce sdk/communication + sdk/commvaultcontentstore sdk/compute sdk/computebulkactions sdk/computefleet diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/CHANGELOG.md b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/CHANGELOG.md new file mode 100644 index 000000000000..3a2e52e8fcbb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-06-24) + +- Azure Resource Manager Commvault Content Store client library for Java. This package contains Microsoft Azure SDK for Commvault Content Store Management SDK. Package api-version 2026-07-03-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-commvaultcontentstore Java SDK. diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/README.md b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/README.md new file mode 100644 index 000000000000..5a178eb158ce --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Commvault Content Store client library for Java + +Azure Resource Manager Commvault Content Store client library for Java. + +This package contains Microsoft Azure SDK for Commvault Content Store Management SDK. Package api-version 2026-07-03-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-commvaultcontentstore;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-commvaultcontentstore + 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(); +CommvaultContentStoreManager manager = CommvaultContentStoreManager + .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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/SAMPLE.md b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/SAMPLE.md new file mode 100644 index 000000000000..1db6b88f3403 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/SAMPLE.md @@ -0,0 +1,1446 @@ +# Code snippets and samples + + +## CloudAccounts + +- [CreateOrUpdate](#cloudaccounts_createorupdate) +- [Delete](#cloudaccounts_delete) +- [GetByResourceGroup](#cloudaccounts_getbyresourcegroup) +- [LatestLinkedSaaS](#cloudaccounts_latestlinkedsaas) +- [LinkSaaS](#cloudaccounts_linksaas) +- [List](#cloudaccounts_list) +- [ListByResourceGroup](#cloudaccounts_listbyresourcegroup) +- [Update](#cloudaccounts_update) + +## Operations + +- [List](#operations_list) + +## Plans + +- [CreateOrupdate](#plans_createorupdate) +- [Delete](#plans_delete) +- [Get](#plans_get) +- [ListByCloudAccount](#plans_listbycloudaccount) + +## ProtectedItems + +- [Get](#protecteditems_get) +- [GetRestorePoints](#protecteditems_getrestorepoints) +- [ListByProtectionGroup](#protecteditems_listbyprotectiongroup) +- [Restore](#protecteditems_restore) + +## ProtectedItemsOperationGroup + +- [CountByProtectionGroups](#protecteditemsoperationgroup_countbyprotectiongroups) + +## ProtectionGroups + +- [Backup](#protectiongroups_backup) +- [CreateOrupdate](#protectiongroups_createorupdate) +- [Delete](#protectiongroups_delete) +- [Get](#protectiongroups_get) +- [ListByCloudAccount](#protectiongroups_listbycloudaccount) +- [Restore](#protectiongroups_restore) +- [ResumeBackup](#protectiongroups_resumebackup) +- [StopBackup](#protectiongroups_stopbackup) + +## RoleMappings + +- [CreateOrUpdate](#rolemappings_createorupdate) +- [Delete](#rolemappings_delete) +- [Get](#rolemappings_get) +- [List](#rolemappings_list) + +## SaaSOperationGroup + +- [ActivateResource](#saasoperationgroup_activateresource) + +## Storages + +- [CreateOrUpdate](#storages_createorupdate) +- [Delete](#storages_delete) +- [Get](#storages_get) +- [ListByCloudAccount](#storages_listbycloudaccount) +### CloudAccounts_CreateOrUpdate + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudAccounts CreateOrUpdate. + */ +public final class CloudAccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_CreateOrUpdate_MinimumSet - CCA create with create-only role bootstrap fields omitted. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void cloudAccountsCreateOrUpdateMinimumSetCCACreateWithCreateOnlyRoleBootstrapFieldsOmitted( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .define("sample-cloudAccountName") + .withRegion("eastus") + .withExistingResourceGroup("rgcommvault") + .withTags(mapOf()) + .withProperties(new CloudAccountProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("tblwyuznrazgchhfczgtlaifwamndt") + .withOfferDetails(new OfferDetails().withPublisherId("npghpdbgiohslbbeihxdwucejb") + .withOfferId("recofyvhkddgkuvducosjstenmy") + .withPlanId("pqoyqqavjh") + .withPlanName("hwcltkdvndwfmmnthzwvocujri") + .withTermUnit("wzrzqyfzrpqhy") + .withTermId("avpgkctrkwdmudsz"))) + .withUser(new UserDetails().withFirstName("John") + .withLastName("Doe") + .withEmailAddress("john.doe@contoso.com") + .withUpn("john.doe@contoso.com") + .withPhoneNumber("1234567890"))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .create(); + } + + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void cloudAccountsCreateOrUpdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .define("sample-cloudAccountName") + .withRegion("sxzmmidsfbba") + .withExistingResourceGroup("rgcommvault") + .withTags(mapOf()) + .withProperties(new CloudAccountProperties().withMarketplace(new MarketplaceDetails() + .withSubscriptionId("tblwyuznrazgchhfczgtlaifwamndt") + .withSaasResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-commvault/providers/Microsoft.SaaS/resources/commvault-saas") + .withOfferDetails(new OfferDetails().withPublisherId("npghpdbgiohslbbeihxdwucejb") + .withOfferId("recofyvhkddgkuvducosjstenmy") + .withPlanId("pqoyqqavjh") + .withPlanName("hwcltkdvndwfmmnthzwvocujri") + .withTermUnit("wzrzqyfzrpqhy") + .withTermId("avpgkctrkwdmudsz"))) + .withUser(new UserDetails().withFirstName("mpiviyooskqkyjqqpgnkderu") + .withLastName("ppkcvfjylquebr") + .withEmailAddress("user@example.com") + .withUpn("frlpmyk") + .withPhoneNumber("mpunfyfckyzpqxotsmclzk")) + .withBackupAdminOnCcaCreate(new EntityInfo().withId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withDisplayName("Tenant Admins") + .withEntityType(EntityType.GROUP)) + .withMultiPersonAuthorizationOnCcaCreate(new EntityInfo().withId("11111111-2222-3333-4444-555555555555") + .withDisplayName("John Smith") + .withEntityType(EntityType.USER))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .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; + } +} +``` + +### CloudAccounts_Delete + +```java +/** + * Samples for CloudAccounts Delete. + */ +public final class CloudAccountsDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().delete("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudAccounts_GetByResourceGroup + +```java +/** + * Samples for CloudAccounts GetByResourceGroup. + */ +public final class CloudAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .getByResourceGroupWithResponse("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudAccounts_LatestLinkedSaaS + +```java +/** + * Samples for CloudAccounts LatestLinkedSaaS. + */ +public final class CloudAccountsLatestLinkedSaaSSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_LatestLinkedSaaS_MaximumSet_Gen.json + */ + /** + * Sample code: Returns the latest SaaS linked to the cloud account. - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void returnsTheLatestSaaSLinkedToTheCloudAccountGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .latestLinkedSaaSWithResponse("rg-commvault", "contoso-cloud-account", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudAccounts_LinkSaaS + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; + +/** + * Samples for CloudAccounts LinkSaaS. + */ +public final class CloudAccountsLinkSaaSSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_LinkSaaS_MaximumSet_Gen.json + */ + /** + * Sample code: Links a new SaaS to the organization of the underlying monitor. - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + linksANewSaaSToTheOrganizationOfTheUnderlyingMonitorGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .linkSaaS("rg-commvault", "contoso-cloud-account", new SaaSData().withSaaSResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-commvault/providers/Microsoft.SaaS/resources/commvault-saas"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CloudAccounts_List + +```java +/** + * Samples for CloudAccounts List. + */ +public final class CloudAccountsListSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListBySubscription_MinimumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListBySubscription_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListBySubscription_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### CloudAccounts_ListByResourceGroup + +```java +/** + * Samples for CloudAccounts ListByResourceGroup. + */ +public final class CloudAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListByResourceGroup_MinimumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().listByResourceGroup("rgcommvault", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().listByResourceGroup("rgcommvault", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudAccounts_Update + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccount; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdateProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudAccounts Update. + */ +public final class CloudAccountsUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_Update_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsUpdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + CloudAccount resource = manager.cloudAccounts() + .getByResourceGroupWithResponse("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .withProperties(new CloudAccountUpdateProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("bojdg") + .withOfferDetails(new OfferDetails().withPublisherId("loowntsnvoynhzto") + .withOfferId("ysmwsuakhwvkosz") + .withPlanId("iskbkfpr") + .withPlanName("pmmlirssfdvdmywddvtl") + .withTermUnit("wbeqzbtvq") + .withTermId("qoebjvpjc"))) + .withUser(new UserDetails().withFirstName("dudsiomjk") + .withLastName("szqupklkgojwozjo") + .withEmailAddress("user@example.com") + .withUpn("wiwwe") + .withPhoneNumber("ebszyfnuyzk"))) + .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; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Plans_CreateOrupdate + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.Retention; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Schedule; +import com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import java.util.Arrays; + +/** + * Samples for Plans CreateOrupdate. + */ +public final class PlansCreateOrupdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_CreateOrupdate_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_CreateOrupdate_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + plansCreateOrupdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans() + .define("sample-planName") + .withExistingCloudAccount("rgcommvault", "sample-cloudAccountName") + .withProperties( + new PlanProperties().withLocation("igaxdfxtzecvxlzgdxzuq") + .withStoragePlans(Arrays.asList( + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))))) + .withSchedules(Arrays.asList( + new Schedule().withBackupType(BackUpType.INCREMENTAL) + .withFrequency(Frequency.DAILY) + .withRunsEvery(17) + .withWeekOfMonth(WeekOfMonth.FIRST) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMonthOfYear(MonthOfYear.JANUARY) + .withDayOfMonth(25) + .withWeeklyDays(Arrays.asList(WeeklyDays.SUNDAY)) + .withTime("xrkimwcrnltnhiotzdguqjddo") + .withTimeZone("tvcpczczysengkxzqfy"), + new Schedule().withBackupType(BackUpType.INCREMENTAL) + .withFrequency(Frequency.DAILY) + .withRunsEvery(17) + .withWeekOfMonth(WeekOfMonth.FIRST) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMonthOfYear(MonthOfYear.JANUARY) + .withDayOfMonth(25) + .withWeeklyDays(Arrays.asList(WeeklyDays.SUNDAY)) + .withTime("xrkimwcrnltnhiotzdguqjddo") + .withTimeZone("tvcpczczysengkxzqfy"))) + .withRetention(new Retention().withNumberOfSnapshots(1))) + .create(); + } +} +``` + +### Plans_Delete + +```java +/** + * Samples for Plans Delete. + */ +public final class PlansDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void plansDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans() + .delete("rgcommvault", "sample-cloudAccountName", "sample-planName", com.azure.core.util.Context.NONE); + } +} +``` + +### Plans_Get + +```java +/** + * Samples for Plans Get. + */ +public final class PlansGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - generated + * by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void plansGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-planName", + com.azure.core.util.Context.NONE); + } +} +``` + +### Plans_ListByCloudAccount + +```java +/** + * Samples for Plans ListByCloudAccount. + */ +public final class PlansListByCloudAccountSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_ListByCloudAccount_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_ListByCloudAccount_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + plansListByCloudAccountMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans().listByCloudAccount("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectedItems_Get + +```java +/** + * Samples for ProtectedItems Get. + */ +public final class ProtectedItemsGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_Get_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + "sample-protectedItemName", com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectedItems_GetRestorePoints + +```java +/** + * Samples for ProtectedItems GetRestorePoints. + */ +public final class ProtectedItemsGetRestorePointsSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_GetRestorePoints_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_GetRestorePoints_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsGetRestorePointsMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .getRestorePointsWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + "sample-protectedItemName", com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectedItems_ListByProtectionGroup + +```java +/** + * Samples for ProtectedItems ListByProtectionGroup. + */ +public final class ProtectedItemsListByProtectionGroupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_ListByProtectionGroup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_ListByProtectionGroup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsListByProtectionGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .listByProtectionGroup("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectedItems_Restore + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; + +/** + * Samples for ProtectedItems Restore. + */ +public final class ProtectedItemsRestoreSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_Restore_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsRestoreMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .restoreWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + "sample-protectedItemName", + new RestoreProtectionItemRequest().withInPlaceRestore(true) + .withRestoreType(RestoreType.NONE) + .withToTime("kgueys") + .withVmDestinationInfo(new VmDestinationInfo().withVmInfoList( + Arrays.asList(new VmInfo().withSourceVmGuid("40000000-aaaa-4bbb-8ccc-000000000000") + .withStorageAccountId("pldvo") + .withPowerOnVmAfterRestore(true) + .withName("ctmwbnzhxqdhshl") + .withResourceGroup("pdfpesq") + .withRegion("ywwecvwsosvatgmulaxfnja") + .withNetworkId("amtetghiqnbjuiurekikacvymxjcv") + .withSubnetId("klskhhutusnzycgxaq") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("40000000-aaaa-4bbb-8ccc-000000000001") + .withVmtags(Arrays.asList(new VmTag().withName("dzabcqlzgqphznrpzhrqbsszgdzjrh") + .withValue("zjtpbngipinqlwajjrf")))))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectedItemsOperationGroup_CountByProtectionGroups + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; +import java.util.Arrays; + +/** + * Samples for ProtectedItemsOperationGroup CountByProtectionGroups. + */ +public final class ProtectedItemsOperationGroupCountByProtectionGroupsSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItemsOperationGroup_CountByProtectionGroups_MinimumSet_Gen.json + */ + /** + * Sample code: ProtectedItemsOperationGroup_CountByProtectionGroups_MinimumSet. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void protectedItemsOperationGroupCountByProtectionGroupsMinimumSet( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItemsOperationGroups() + .countByProtectionGroupsWithResponse(new CountProtectedItemsRequest().withResourceIds(Arrays.asList( + "/subscriptions/65D4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName", + "/subscriptions/A7E4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault2/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName2")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItemsOperationGroup_CountByProtectionGroups_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItemsOperationGroup_CountByProtectionGroups_MaximumSet. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void protectedItemsOperationGroupCountByProtectionGroupsMaximumSet( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItemsOperationGroups() + .countByProtectionGroupsWithResponse(new CountProtectedItemsRequest().withResourceIds(Arrays.asList( + "/subscriptions/65D4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName", + "/subscriptions/A7E4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault2/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName2")), + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_Backup + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.BackupLevel; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupOptions; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.VmListItem; +import java.util.Arrays; + +/** + * Samples for ProtectionGroups Backup. + */ +public final class ProtectionGroupsBackupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Backup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Backup_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsBackupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .backupWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + new BackupProtectionGroupRequest() + .withVmList(Arrays.asList(new VmListItem().withVmGuid("40000000-aaaa-4bbb-8ccc-000000000000"))) + .withBackupOptions(new BackupOptions().withBackupLevel(BackupLevel.FULL) + .withJobDescription("Ad-hoc backup job") + .withBackupCopyImmediately(true) + .withRunSnapShotBackup(true) + .withNotifyUserOnJobCompletion(true)), + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_CreateOrupdate + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.util.Arrays; + +/** + * Samples for ProtectionGroups CreateOrupdate. + */ +public final class ProtectionGroupsCreateOrupdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_CreateOrupdate_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_CreateOrupdate_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsCreateOrupdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .define("sample-protectionGroupName") + .withExistingCloudAccount("rgcommvault", "sample-cloudAccountName") + .withProperties(new ProtectionGroupProperties().withPlan("ibcuuodwnnvgyhy") + .withResources(new ProtectionGroupResources().withManual(Arrays.asList("uljwtwhm")) + .withMatchRules(new ProtectionGroupResourcesMatchRules() + .withRules(Arrays.asList(new Rule().withProperty(RuleProperty.RESOURCE_GROUP) + .withOperator(Operator.CONTAINS) + .withValue("dgkmghsgmrbaatklarukbx"))) + .withMatchType(MatchType.ALL)))) + .create(); + } +} +``` + +### ProtectionGroups_Delete + +```java +/** + * Samples for ProtectionGroups Delete. + */ +public final class ProtectionGroupsDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .delete("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_Get + +```java +/** + * Samples for ProtectionGroups Get. + */ +public final class ProtectionGroupsGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Get_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_ListByCloudAccount + +```java +/** + * Samples for ProtectionGroups ListByCloudAccount. + */ +public final class ProtectionGroupsListByCloudAccountSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_ListByCloudAccount_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_ListByCloudAccount_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsListByCloudAccountMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .listByCloudAccount("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_Restore + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; + +/** + * Samples for ProtectionGroups Restore. + */ +public final class ProtectionGroupsRestoreSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Restore_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsRestoreMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .restoreWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + new RestoreProtectionItemRequest().withInPlaceRestore(true) + .withRestoreType(RestoreType.NONE) + .withToTime("kgueys") + .withVmDestinationInfo(new VmDestinationInfo().withVmInfoList( + Arrays.asList(new VmInfo().withSourceVmGuid("40000000-aaaa-4bbb-8ccc-000000000000") + .withStorageAccountId("pldvo") + .withPowerOnVmAfterRestore(true) + .withName("ctmwbnzhxqdhshl") + .withResourceGroup("pdfpesq") + .withRegion("ywwecvwsosvatgmulaxfnja") + .withNetworkId("amtetghiqnbjuiurekikacvymxjcv") + .withSubnetId("klskhhutusnzycgxaq") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("40000000-aaaa-4bbb-8ccc-000000000001") + .withVmtags(Arrays.asList(new VmTag().withName("dzabcqlzgqphznrpzhrqbsszgdzjrh") + .withValue("zjtpbngipinqlwajjrf")))))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_ResumeBackup + +```java +/** + * Samples for ProtectionGroups ResumeBackup. + */ +public final class ProtectionGroupsResumeBackupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_ResumeBackup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_ResumeBackup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsResumeBackupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .resumeBackupWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} +``` + +### ProtectionGroups_StopBackup + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; + +/** + * Samples for ProtectionGroups StopBackup. + */ +public final class ProtectionGroupsStopBackupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_StopBackup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_StopBackup_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsStopBackupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .stopBackup("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + new StopBackupProtectionGroupRequest().withReason("auzneewhs").withComment("ipaalpltffowhwzoxqmcc"), + com.azure.core.util.Context.NONE); + } +} +``` + +### RoleMappings_CreateOrUpdate + +```java +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import java.util.Arrays; + +/** + * Samples for RoleMappings CreateOrUpdate. + */ +public final class RoleMappingsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: RoleMappings_CreateOrUpdate_MinimumSet - Single BackupAdmin role only. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsCreateOrUpdateMinimumSetSingleBackupAdminRoleOnly( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings() + .createOrUpdateWithResponse("rgcommvault", "myCloudAccount", + new RoleMappingInner().withProperties(new RoleMappingProperties() + .withRoles(Arrays.asList(new RoleAssignment().withRoleName(RoleName.BACKUP_ADMIN) + .withEntities(Arrays.asList(new EntityInfo().withId("a1b2c3d4-e5f6-7890-abcd-ef1234567890") + .withDisplayName("Tenant Admins") + .withEntityType(EntityType.GROUP)))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsCreateOrUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings() + .createOrUpdateWithResponse("rgcommvault", "myCloudAccount", + new RoleMappingInner() + .withProperties( + new RoleMappingProperties() + .withRoles( + Arrays + .asList( + new RoleAssignment().withRoleName(RoleName.BACKUP_ADMIN) + .withEntities( + Arrays + .asList( + new EntityInfo().withId("a1b2c3d4-e5f6-7890-abcd-ef1234567890") + .withDisplayName("Backup Admins Group") + .withEntityType(EntityType.GROUP))), + new RoleAssignment().withRoleName(RoleName.BACKUP_OPERATOR) + .withEntities(Arrays.asList( + new EntityInfo().withId("11111111-2222-3333-4444-555555555555") + .withDisplayName("Commvault-Operators") + .withEntityType(EntityType.GROUP), + new EntityInfo() + .withId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withDisplayName("John Smith") + .withEntityType(EntityType.USER))), + new RoleAssignment().withRoleName(RoleName.BACKUP_USER) + .withEntities(Arrays + .asList(new EntityInfo().withId("22222222-3333-4444-5555-666666666666") + .withDisplayName("Jane Doe") + .withEntityType(EntityType.USER)))))), + com.azure.core.util.Context.NONE); + } +} +``` + +### RoleMappings_Delete + +```java +/** + * Samples for RoleMappings Delete. + */ +public final class RoleMappingsDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_Delete_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsDeleteMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings() + .deleteByResourceGroupWithResponse("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### RoleMappings_Get + +```java +/** + * Samples for RoleMappings Get. + */ +public final class RoleMappingsGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_Get_MinimumSet_Gen.json + */ + /** + * Sample code: RoleMappings_Get_MinimumSet - Get role mappings with single role. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsGetMinimumSetGetRoleMappingsWithSingleRole( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().getWithResponse("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_Get_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().getWithResponse("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### RoleMappings_List + +```java +/** + * Samples for RoleMappings List. + */ +public final class RoleMappingsListSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_List_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_List. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + roleMappingsList(com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().list("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_List_MinimumSet_Gen.json + */ + /** + * Sample code: RoleMappings_List_MinimumSet - List role mappings with single role. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsListMinimumSetListRoleMappingsWithSingleRole( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().list("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### SaaSOperationGroup_ActivateResource + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; + +/** + * Samples for SaaSOperationGroup ActivateResource. + */ +public final class SaaSOperationGroupActivateResourceSamples { + /* + * x-ms-original-file: 2026-07-03-preview/SaaSOperationGroup_ActivateResource_MaximumSet_Gen.json + */ + /** + * Sample code: SaaSOperationGroup_ActivateResource_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void saaSOperationGroupActivateResourceMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.saaSOperationGroups() + .activateResource(new ActivateSaaSParameterRequest().withSaaSGuid("55555555-6666-7777-8888-999999999999"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/SaaSOperationGroup_ActivateResource_MinimumSet_Gen.json + */ + /** + * Sample code: SaaSOperationGroup_ActivateResource_MaximumSet - generated by [MaximumSet] rule - generated by + * [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void saaSOperationGroupActivateResourceMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.saaSOperationGroups() + .activateResource(new ActivateSaaSParameterRequest().withSaaSGuid("55555555-6666-7777-8888-999999999999"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Storages_CreateOrUpdate + +```java +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; + +/** + * Samples for Storages CreateOrUpdate. + */ +public final class StoragesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + storagesCreateOrUpdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .define("sample-storageName") + .withExistingCloudAccount("rgcommvault", "sample-cloudAccountName") + .withProperties(new StorageProperties().withLocation("idxxvyqhyxvahalfmkbjxklfbimouxnasnxdmaydqv") + .withStorageType(StorageType.AIR_GAP_PROTECT) + .withVendor(Vendor.AZURE_BLOB_STORAGE) + .withClassProperty(StorageClassType.COOL)) + .create(); + } +} +``` + +### Storages_Delete + +```java +/** + * Samples for Storages Delete. + */ +public final class StoragesDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + storagesDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .delete("rgcommvault", "sample-cloudAccountName", "sample-storageName", com.azure.core.util.Context.NONE); + } +} +``` + +### Storages_Get + +```java +/** + * Samples for Storages Get. + */ +public final class StoragesGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void storagesGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-storageName", + com.azure.core.util.Context.NONE); + } +} +``` + +### Storages_ListByCloudAccount + +```java +/** + * Samples for Storages ListByCloudAccount. + */ +public final class StoragesListByCloudAccountSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_ListByCloudAccount_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_ListByCloudAccount_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + storagesListByCloudAccountMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .listByCloudAccount("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/pom.xml b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/pom.xml new file mode 100644 index 000000000000..d940546da083 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/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-commvaultcontentstore + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Commvault Content Store Management + This package contains Microsoft Azure SDK for Commvault Content Store Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package api-version 2026-07-03-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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/CommvaultContentStoreManager.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/CommvaultContentStoreManager.java new file mode 100644 index 000000000000..44dbc0c8ed0e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/CommvaultContentStoreManager.java @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore; + +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.commvaultcontentstore.fluent.CommvaultContentStoreManagementClient; +import com.azure.resourcemanager.commvaultcontentstore.implementation.CloudAccountsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.CommvaultContentStoreManagementClientBuilder; +import com.azure.resourcemanager.commvaultcontentstore.implementation.OperationsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.PlansImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.ProtectedItemsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.ProtectedItemsOperationGroupsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.ProtectionGroupsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.RoleMappingsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.SaaSOperationGroupsImpl; +import com.azure.resourcemanager.commvaultcontentstore.implementation.StoragesImpl; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccounts; +import com.azure.resourcemanager.commvaultcontentstore.models.Operations; +import com.azure.resourcemanager.commvaultcontentstore.models.Plans; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItems; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItemsOperationGroups; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroups; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappings; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSOperationGroups; +import com.azure.resourcemanager.commvaultcontentstore.models.Storages; +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 CommvaultContentStoreManager. + */ +public final class CommvaultContentStoreManager { + private Operations operations; + + private CloudAccounts cloudAccounts; + + private SaaSOperationGroups saaSOperationGroups; + + private Storages storages; + + private Plans plans; + + private ProtectionGroups protectionGroups; + + private ProtectedItems protectedItems; + + private ProtectedItemsOperationGroups protectedItemsOperationGroups; + + private RoleMappings roleMappings; + + private final CommvaultContentStoreManagementClient clientObject; + + private CommvaultContentStoreManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new CommvaultContentStoreManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Commvault Content Store service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Commvault Content Store service API instance. + */ + public static CommvaultContentStoreManager 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 Commvault Content Store service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Commvault Content Store service API instance. + */ + public static CommvaultContentStoreManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CommvaultContentStoreManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create CommvaultContentStoreManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CommvaultContentStoreManager.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-commvaultcontentstore.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 Commvault Content Store service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Commvault Content Store service API instance. + */ + public CommvaultContentStoreManager 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.commvaultcontentstore") + .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 CommvaultContentStoreManager(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 CloudAccounts. It manages CloudAccount. + * + * @return Resource collection API of CloudAccounts. + */ + public CloudAccounts cloudAccounts() { + if (this.cloudAccounts == null) { + this.cloudAccounts = new CloudAccountsImpl(clientObject.getCloudAccounts(), this); + } + return cloudAccounts; + } + + /** + * Gets the resource collection API of SaaSOperationGroups. + * + * @return Resource collection API of SaaSOperationGroups. + */ + public SaaSOperationGroups saaSOperationGroups() { + if (this.saaSOperationGroups == null) { + this.saaSOperationGroups = new SaaSOperationGroupsImpl(clientObject.getSaaSOperationGroups(), this); + } + return saaSOperationGroups; + } + + /** + * Gets the resource collection API of Storages. It manages Storage. + * + * @return Resource collection API of Storages. + */ + public Storages storages() { + if (this.storages == null) { + this.storages = new StoragesImpl(clientObject.getStorages(), this); + } + return storages; + } + + /** + * Gets the resource collection API of Plans. It manages CommvaultPlan. + * + * @return Resource collection API of Plans. + */ + public Plans plans() { + if (this.plans == null) { + this.plans = new PlansImpl(clientObject.getPlans(), this); + } + return plans; + } + + /** + * Gets the resource collection API of ProtectionGroups. It manages ProtectionGroup. + * + * @return Resource collection API of ProtectionGroups. + */ + public ProtectionGroups protectionGroups() { + if (this.protectionGroups == null) { + this.protectionGroups = new ProtectionGroupsImpl(clientObject.getProtectionGroups(), this); + } + return protectionGroups; + } + + /** + * Gets the resource collection API of ProtectedItems. + * + * @return Resource collection API of ProtectedItems. + */ + public ProtectedItems protectedItems() { + if (this.protectedItems == null) { + this.protectedItems = new ProtectedItemsImpl(clientObject.getProtectedItems(), this); + } + return protectedItems; + } + + /** + * Gets the resource collection API of ProtectedItemsOperationGroups. + * + * @return Resource collection API of ProtectedItemsOperationGroups. + */ + public ProtectedItemsOperationGroups protectedItemsOperationGroups() { + if (this.protectedItemsOperationGroups == null) { + this.protectedItemsOperationGroups + = new ProtectedItemsOperationGroupsImpl(clientObject.getProtectedItemsOperationGroups(), this); + } + return protectedItemsOperationGroups; + } + + /** + * Gets the resource collection API of RoleMappings. + * + * @return Resource collection API of RoleMappings. + */ + public RoleMappings roleMappings() { + if (this.roleMappings == null) { + this.roleMappings = new RoleMappingsImpl(clientObject.getRoleMappings(), this); + } + return roleMappings; + } + + /** + * Gets wrapped service client CommvaultContentStoreManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client CommvaultContentStoreManagementClient. + */ + public CommvaultContentStoreManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CloudAccountsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CloudAccountsClient.java new file mode 100644 index 000000000000..6f6f624176d0 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CloudAccountsClient.java @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.CloudAccountInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdate; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; + +/** + * An instance of this class provides access to all the operations defined in CloudAccountsClient. + */ +public interface CloudAccountsClient { + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String cloudAccountName, + Context context); + + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner getByResourceGroup(String resourceGroupName, String cloudAccountName); + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudAccountInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountInner resource); + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudAccountInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountInner resource, Context context); + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner createOrUpdate(String resourceGroupName, String cloudAccountName, CloudAccountInner resource); + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner createOrUpdate(String resourceGroupName, String cloudAccountName, CloudAccountInner resource, + Context context); + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link SyncPoller} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudAccountInner> beginUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountUpdate properties); + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudAccountInner> beginUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountUpdate properties, Context context); + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner update(String resourceGroupName, String cloudAccountName, CloudAccountUpdate properties); + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner update(String resourceGroupName, String cloudAccountName, CloudAccountUpdate properties, + Context context); + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName); + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, Context context); + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName); + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudAccountName, Context context); + + /** + * List CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List CloudAccount resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List CloudAccount resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudAccountInner> beginLinkSaaS(String resourceGroupName, + String cloudAccountName, SaaSData body); + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudAccountInner> beginLinkSaaS(String resourceGroupName, + String cloudAccountName, SaaSData body, Context context); + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body); + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudAccountInner linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body, Context context); + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response latestLinkedSaaSWithResponse(String resourceGroupName, + String cloudAccountName, Context context); + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LatestLinkedSaaSResponseInner latestLinkedSaaS(String resourceGroupName, String cloudAccountName); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CommvaultContentStoreManagementClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CommvaultContentStoreManagementClient.java new file mode 100644 index 000000000000..5a20f050888a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CommvaultContentStoreManagementClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for CommvaultContentStoreManagementClient class. + */ +public interface CommvaultContentStoreManagementClient { + /** + * 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 CloudAccountsClient object to access its operations. + * + * @return the CloudAccountsClient object. + */ + CloudAccountsClient getCloudAccounts(); + + /** + * Gets the SaaSOperationGroupsClient object to access its operations. + * + * @return the SaaSOperationGroupsClient object. + */ + SaaSOperationGroupsClient getSaaSOperationGroups(); + + /** + * Gets the StoragesClient object to access its operations. + * + * @return the StoragesClient object. + */ + StoragesClient getStorages(); + + /** + * Gets the PlansClient object to access its operations. + * + * @return the PlansClient object. + */ + PlansClient getPlans(); + + /** + * Gets the ProtectionGroupsClient object to access its operations. + * + * @return the ProtectionGroupsClient object. + */ + ProtectionGroupsClient getProtectionGroups(); + + /** + * Gets the ProtectedItemsClient object to access its operations. + * + * @return the ProtectedItemsClient object. + */ + ProtectedItemsClient getProtectedItems(); + + /** + * Gets the ProtectedItemsOperationGroupsClient object to access its operations. + * + * @return the ProtectedItemsOperationGroupsClient object. + */ + ProtectedItemsOperationGroupsClient getProtectedItemsOperationGroups(); + + /** + * Gets the RoleMappingsClient object to access its operations. + * + * @return the RoleMappingsClient object. + */ + RoleMappingsClient getRoleMappings(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/OperationsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/OperationsClient.java new file mode 100644 index 000000000000..d6a11ab9538c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/PlansClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/PlansClient.java new file mode 100644 index 000000000000..cc8e70585d4b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/PlansClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.CommvaultPlanInner; + +/** + * An instance of this class provides access to all the operations defined in PlansClient. + */ +public interface PlansClient { + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String cloudAccountName, String planName, + Context context); + + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommvaultPlanInner get(String resourceGroupName, String cloudAccountName, String planName); + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommvaultPlanInner> beginCreateOrupdate(String resourceGroupName, + String cloudAccountName, String planName, CommvaultPlanInner resource); + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommvaultPlanInner> beginCreateOrupdate(String resourceGroupName, + String cloudAccountName, String planName, CommvaultPlanInner resource, Context context); + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommvaultPlanInner createOrupdate(String resourceGroupName, String cloudAccountName, String planName, + CommvaultPlanInner resource); + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommvaultPlanInner createOrupdate(String resourceGroupName, String cloudAccountName, String planName, + CommvaultPlanInner resource, Context context); + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 cloudAccountName, String planName); + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, String planName, + Context context); + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 cloudAccountName, String planName); + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudAccountName, String planName, Context context); + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName); + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsClient.java new file mode 100644 index 000000000000..820ac0c473d8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsClient.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; + +/** + * An instance of this class provides access to all the operations defined in ProtectedItemsClient. + */ +public interface ProtectedItemsClient { + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context); + + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProtectedItemInner get(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName); + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName); + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getRestorePointsWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context); + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointsInner getRestorePoints(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName); + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response restoreWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, RestoreProtectionItemRequest request, Context context); + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreProtectionItemResponseInner restore(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, RestoreProtectionItemRequest request); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsOperationGroupsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsOperationGroupsClient.java new file mode 100644 index 000000000000..e70f59ff5296 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsOperationGroupsClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; + +/** + * An instance of this class provides access to all the operations defined in ProtectedItemsOperationGroupsClient. + */ +public interface ProtectedItemsOperationGroupsClient { + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response countByProtectionGroupsWithResponse(CountProtectedItemsRequest body, + Context context); + + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CountProtectedItemsResponseInner countByProtectionGroups(CountProtectedItemsRequest body); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectionGroupsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectionGroupsClient.java new file mode 100644 index 000000000000..9cf8674e8d62 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectionGroupsClient.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; + +/** + * An instance of this class provides access to all the operations defined in ProtectionGroupsClient. + */ +public interface ProtectionGroupsClient { + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProtectionGroupInner get(String resourceGroupName, String cloudAccountName, String protectionGroupName); + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProtectionGroupInner> beginCreateOrupdate(String resourceGroupName, + String cloudAccountName, String protectionGroupName, ProtectionGroupInner resource); + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProtectionGroupInner> beginCreateOrupdate(String resourceGroupName, + String cloudAccountName, String protectionGroupName, ProtectionGroupInner resource, Context context); + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProtectionGroupInner createOrupdate(String resourceGroupName, String cloudAccountName, String protectionGroupName, + ProtectionGroupInner resource); + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProtectionGroupInner createOrupdate(String resourceGroupName, String cloudAccountName, String protectionGroupName, + ProtectionGroupInner resource, Context context); + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 cloudAccountName, + String protectionGroupName); + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 cloudAccountName, String protectionGroupName); + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudAccountName, String protectionGroupName, Context context); + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName); + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context); + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStopBackup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request); + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStopBackup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request, Context context); + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request); + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request, Context context); + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response restoreWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, RestoreProtectionItemRequest request, Context context); + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreProtectionItemResponseInner restore(String resourceGroupName, String cloudAccountName, + String protectionGroupName, RestoreProtectionItemRequest request); + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response resumeBackupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 resumeBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName); + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response backupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request, Context context); + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupProtectionGroupResponseInner backup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/RoleMappingsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/RoleMappingsClient.java new file mode 100644 index 000000000000..d988387be62f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/RoleMappingsClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; + +/** + * An instance of this class provides access to all the operations defined in RoleMappingsClient. + */ +public interface RoleMappingsClient { + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String cloudAccountName, Context context); + + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleMappingInner get(String resourceGroupName, String cloudAccountName); + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Role Mapping Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + RoleMappingInner resource, Context context); + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Role Mapping Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleMappingInner createOrUpdate(String resourceGroupName, String cloudAccountName, RoleMappingInner resource); + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String cloudAccountName, Context context); + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName); + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cloudAccountName); + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cloudAccountName, Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/SaaSOperationGroupsClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/SaaSOperationGroupsClient.java new file mode 100644 index 000000000000..9636e61afe7a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/SaaSOperationGroupsClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; + +/** + * An instance of this class provides access to all the operations defined in SaaSOperationGroupsClient. + */ +public interface SaaSOperationGroupsClient { + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaaSResourceDetailsResponseInner> + beginActivateResource(ActivateSaaSParameterRequest body); + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SaaSResourceDetailsResponseInner> + beginActivateResource(ActivateSaaSParameterRequest body, Context context); + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaaSResourceDetailsResponseInner activateResource(ActivateSaaSParameterRequest body); + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SaaSResourceDetailsResponseInner activateResource(ActivateSaaSParameterRequest body, Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/StoragesClient.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/StoragesClient.java new file mode 100644 index 000000000000..54b3146faa84 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/StoragesClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.StorageInner; + +/** + * An instance of this class provides access to all the operations defined in StoragesClient. + */ +public interface StoragesClient { + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String cloudAccountName, String storageName, + Context context); + + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageInner get(String resourceGroupName, String cloudAccountName, String storageName); + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, String storageName, StorageInner resource); + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, String storageName, StorageInner resource, Context context); + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageInner createOrUpdate(String resourceGroupName, String cloudAccountName, String storageName, + StorageInner resource); + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageInner createOrUpdate(String resourceGroupName, String cloudAccountName, String storageName, + StorageInner resource, Context context); + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 cloudAccountName, + String storageName); + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, + String storageName, Context context); + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 cloudAccountName, String storageName); + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudAccountName, String storageName, Context context); + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName); + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/BackupProtectionGroupResponseInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/BackupProtectionGroupResponseInner.java new file mode 100644 index 000000000000..4715265916bb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/BackupProtectionGroupResponseInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 java.io.IOException; +import java.util.List; + +/** + * Backup job response for a Protection Group. + */ +@Immutable +public final class BackupProtectionGroupResponseInner implements JsonSerializable { + /* + * The Commvault response for taskId + */ + private int taskId; + + /* + * The jobIds returned from Commvault. + */ + private List jobIds; + + /** + * Creates an instance of BackupProtectionGroupResponseInner class. + */ + private BackupProtectionGroupResponseInner() { + } + + /** + * Get the taskId property: The Commvault response for taskId. + * + * @return the taskId value. + */ + public int taskId() { + return this.taskId; + } + + /** + * Get the jobIds property: The jobIds returned from Commvault. + * + * @return the jobIds value. + */ + public List jobIds() { + return this.jobIds; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupProtectionGroupResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupProtectionGroupResponseInner 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 BackupProtectionGroupResponseInner. + */ + public static BackupProtectionGroupResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupProtectionGroupResponseInner deserializedBackupProtectionGroupResponseInner + = new BackupProtectionGroupResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedBackupProtectionGroupResponseInner.taskId = reader.getInt(); + } else if ("jobIds".equals(fieldName)) { + List jobIds = reader.readArray(reader1 -> reader1.getString()); + deserializedBackupProtectionGroupResponseInner.jobIds = jobIds; + } else { + reader.skipChildren(); + } + } + + return deserializedBackupProtectionGroupResponseInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CloudAccountInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CloudAccountInner.java new file mode 100644 index 000000000000..4f53bfd98d17 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CloudAccountInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.models.CloudAccountProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * A Commvault Cloud Account Resource. + */ +@Fluent +public final class CloudAccountInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CloudAccountProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * 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 CloudAccountInner class. + */ + public CloudAccountInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public CloudAccountProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CloudAccountInner object itself. + */ + public CloudAccountInner withProperties(CloudAccountProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the CloudAccountInner object itself. + */ + public CloudAccountInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 CloudAccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CloudAccountInner 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); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudAccountInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudAccountInner 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 CloudAccountInner. + */ + public static CloudAccountInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudAccountInner deserializedCloudAccountInner = new CloudAccountInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCloudAccountInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCloudAccountInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCloudAccountInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCloudAccountInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCloudAccountInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCloudAccountInner.properties = CloudAccountProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedCloudAccountInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCloudAccountInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudAccountInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CommvaultPlanInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CommvaultPlanInner.java new file mode 100644 index 000000000000..259f6435e99d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CommvaultPlanInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; +import java.io.IOException; + +/** + * A Commvault Plan Resource. + */ +@Fluent +public final class CommvaultPlanInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PlanProperties 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 CommvaultPlanInner class. + */ + public CommvaultPlanInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PlanProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CommvaultPlanInner object itself. + */ + public CommvaultPlanInner withProperties(PlanProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 CommvaultPlanInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommvaultPlanInner 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 CommvaultPlanInner. + */ + public static CommvaultPlanInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommvaultPlanInner deserializedCommvaultPlanInner = new CommvaultPlanInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCommvaultPlanInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCommvaultPlanInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCommvaultPlanInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCommvaultPlanInner.properties = PlanProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCommvaultPlanInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommvaultPlanInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CountProtectedItemsResponseInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CountProtectedItemsResponseInner.java new file mode 100644 index 000000000000..bd1432261aea --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CountProtectedItemsResponseInner.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.commvaultcontentstore.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 java.io.IOException; + +/** + * Response for count protected items operation. + */ +@Immutable +public final class CountProtectedItemsResponseInner implements JsonSerializable { + /* + * The count of protected items. + */ + private String count; + + /** + * Creates an instance of CountProtectedItemsResponseInner class. + */ + private CountProtectedItemsResponseInner() { + } + + /** + * Get the count property: The count of protected items. + * + * @return the count value. + */ + public String count() { + return this.count; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("count", this.count); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CountProtectedItemsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CountProtectedItemsResponseInner 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 CountProtectedItemsResponseInner. + */ + public static CountProtectedItemsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CountProtectedItemsResponseInner deserializedCountProtectedItemsResponseInner + = new CountProtectedItemsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedCountProtectedItemsResponseInner.count = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCountProtectedItemsResponseInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/LatestLinkedSaaSResponseInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/LatestLinkedSaaSResponseInner.java new file mode 100644 index 000000000000..060e50eb5ea8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/LatestLinkedSaaSResponseInner.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.commvaultcontentstore.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 java.io.IOException; + +/** + * Response of get latest linked SaaS resource operation. + */ +@Immutable +public final class LatestLinkedSaaSResponseInner implements JsonSerializable { + /* + * SaaS resource id + */ + private String saaSResourceId; + + /* + * Flag indicating if the SaaS resource is hidden + */ + private Boolean isHiddenSaaS; + + /** + * Creates an instance of LatestLinkedSaaSResponseInner class. + */ + private LatestLinkedSaaSResponseInner() { + } + + /** + * Get the saaSResourceId property: SaaS resource id. + * + * @return the saaSResourceId value. + */ + public String saaSResourceId() { + return this.saaSResourceId; + } + + /** + * Get the isHiddenSaaS property: Flag indicating if the SaaS resource is hidden. + * + * @return the isHiddenSaaS value. + */ + public Boolean isHiddenSaaS() { + return this.isHiddenSaaS; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("saaSResourceId", this.saaSResourceId); + jsonWriter.writeBooleanField("isHiddenSaaS", this.isHiddenSaaS); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LatestLinkedSaaSResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LatestLinkedSaaSResponseInner 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 LatestLinkedSaaSResponseInner. + */ + public static LatestLinkedSaaSResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LatestLinkedSaaSResponseInner deserializedLatestLinkedSaaSResponseInner + = new LatestLinkedSaaSResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("saaSResourceId".equals(fieldName)) { + deserializedLatestLinkedSaaSResponseInner.saaSResourceId = reader.getString(); + } else if ("isHiddenSaaS".equals(fieldName)) { + deserializedLatestLinkedSaaSResponseInner.isHiddenSaaS = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedLatestLinkedSaaSResponseInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/OperationInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/OperationInner.java new file mode 100644 index 000000000000..bfad3e7e4435 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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.commvaultcontentstore.models.ActionType; +import com.azure.resourcemanager.commvaultcontentstore.models.OperationDisplay; +import com.azure.resourcemanager.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectedItemInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectedItemInner.java new file mode 100644 index 000000000000..ac166fe20249 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectedItemInner.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.models.ProtectedItemProperties; +import java.io.IOException; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class ProtectedItemInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ProtectedItemProperties 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 ProtectedItemInner class. + */ + private ProtectedItemInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ProtectedItemProperties 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 ProtectedItemInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectedItemInner 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 ProtectedItemInner. + */ + public static ProtectedItemInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectedItemInner deserializedProtectedItemInner = new ProtectedItemInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectedItemInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectedItemInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectedItemInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedProtectedItemInner.properties = ProtectedItemProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedProtectedItemInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectedItemInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectionGroupInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectionGroupInner.java new file mode 100644 index 000000000000..fc8b35acef45 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectionGroupInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import java.io.IOException; + +/** + * A Commvault Plan Resource. + */ +@Fluent +public final class ProtectionGroupInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ProtectionGroupProperties 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 ProtectionGroupInner class. + */ + public ProtectionGroupInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ProtectionGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ProtectionGroupInner object itself. + */ + public ProtectionGroupInner withProperties(ProtectionGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 ProtectionGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionGroupInner 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 ProtectionGroupInner. + */ + public static ProtectionGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionGroupInner deserializedProtectionGroupInner = new ProtectionGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProtectionGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProtectionGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProtectionGroupInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedProtectionGroupInner.properties = ProtectionGroupProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedProtectionGroupInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionGroupInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestorePointsInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestorePointsInner.java new file mode 100644 index 000000000000..dbf1568f189f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestorePointsInner.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.commvaultcontentstore.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 java.io.IOException; +import java.util.List; + +/** + * Restore points of a Protected Item. + */ +@Immutable +public final class RestorePointsInner implements JsonSerializable { + /* + * The Commvault Protected Item Restore points + */ + private List restoreTimes; + + /** + * Creates an instance of RestorePointsInner class. + */ + private RestorePointsInner() { + } + + /** + * Get the restoreTimes property: The Commvault Protected Item Restore points. + * + * @return the restoreTimes value. + */ + public List restoreTimes() { + return this.restoreTimes; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestorePointsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestorePointsInner 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 RestorePointsInner. + */ + public static RestorePointsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestorePointsInner deserializedRestorePointsInner = new RestorePointsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("restoreTimes".equals(fieldName)) { + List restoreTimes = reader.readArray(reader1 -> reader1.getLong()); + deserializedRestorePointsInner.restoreTimes = restoreTimes; + } else { + reader.skipChildren(); + } + } + + return deserializedRestorePointsInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestoreProtectionItemResponseInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestoreProtectionItemResponseInner.java new file mode 100644 index 000000000000..1d00f547d85d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestoreProtectionItemResponseInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 java.io.IOException; +import java.util.List; + +/** + * Restore resource response for a Protected Item. + */ +@Immutable +public final class RestoreProtectionItemResponseInner implements JsonSerializable { + /* + * The Commvault response for taskId + */ + private int taskId; + + /* + * The jobIds returned from Commvault. + */ + private List jobIds; + + /** + * Creates an instance of RestoreProtectionItemResponseInner class. + */ + private RestoreProtectionItemResponseInner() { + } + + /** + * Get the taskId property: The Commvault response for taskId. + * + * @return the taskId value. + */ + public int taskId() { + return this.taskId; + } + + /** + * Get the jobIds property: The jobIds returned from Commvault. + * + * @return the jobIds value. + */ + public List jobIds() { + return this.jobIds; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreProtectionItemResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreProtectionItemResponseInner 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 RestoreProtectionItemResponseInner. + */ + public static RestoreProtectionItemResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreProtectionItemResponseInner deserializedRestoreProtectionItemResponseInner + = new RestoreProtectionItemResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taskId".equals(fieldName)) { + deserializedRestoreProtectionItemResponseInner.taskId = reader.getInt(); + } else if ("jobIds".equals(fieldName)) { + List jobIds = reader.readArray(reader1 -> reader1.getString()); + deserializedRestoreProtectionItemResponseInner.jobIds = jobIds; + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreProtectionItemResponseInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RoleMappingInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RoleMappingInner.java new file mode 100644 index 000000000000..b862029e80c6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RoleMappingInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; +import java.io.IOException; + +/** + * A Commvault Role Mapping Resource. Singleton per Cloud Account - maps Entra security groups to Commvault roles for + * RBAC enforcement. + */ +@Fluent +public final class RoleMappingInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private RoleMappingProperties 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 RoleMappingInner class. + */ + public RoleMappingInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public RoleMappingProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the RoleMappingInner object itself. + */ + public RoleMappingInner withProperties(RoleMappingProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 RoleMappingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoleMappingInner 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 RoleMappingInner. + */ + public static RoleMappingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RoleMappingInner deserializedRoleMappingInner = new RoleMappingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRoleMappingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRoleMappingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRoleMappingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRoleMappingInner.properties = RoleMappingProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedRoleMappingInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRoleMappingInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/SaaSResourceDetailsResponseInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/SaaSResourceDetailsResponseInner.java new file mode 100644 index 000000000000..8748ac5dfea9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/SaaSResourceDetailsResponseInner.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 java.io.IOException; + +/** + * Marketplace SaaS resource details. + */ +@Immutable +public final class SaaSResourceDetailsResponseInner extends ProxyResource { + /* + * Id of the Marketplace SaaS Resource + */ + private String saaSResourceId; + + /* + * 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 SaaSResourceDetailsResponseInner class. + */ + private SaaSResourceDetailsResponseInner() { + } + + /** + * Get the saaSResourceId property: Id of the Marketplace SaaS Resource. + * + * @return the saaSResourceId value. + */ + public String saaSResourceId() { + return this.saaSResourceId; + } + + /** + * 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.writeStringField("saaSResourceId", this.saaSResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SaaSResourceDetailsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SaaSResourceDetailsResponseInner 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 SaaSResourceDetailsResponseInner. + */ + public static SaaSResourceDetailsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SaaSResourceDetailsResponseInner deserializedSaaSResourceDetailsResponseInner + = new SaaSResourceDetailsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSaaSResourceDetailsResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSaaSResourceDetailsResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSaaSResourceDetailsResponseInner.type = reader.getString(); + } else if ("saaSResourceId".equals(fieldName)) { + deserializedSaaSResourceDetailsResponseInner.saaSResourceId = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedSaaSResourceDetailsResponseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSaaSResourceDetailsResponseInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/StorageInner.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/StorageInner.java new file mode 100644 index 000000000000..0626530c13d9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/StorageInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; +import java.io.IOException; + +/** + * A Commvault Storage Resource. + */ +@Fluent +public final class StorageInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private StorageProperties 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 StorageInner class. + */ + public StorageInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public StorageProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the StorageInner object itself. + */ + public StorageInner withProperties(StorageProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 StorageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageInner 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 StorageInner. + */ + public static StorageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageInner deserializedStorageInner = new StorageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStorageInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStorageInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedStorageInner.properties = StorageProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStorageInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageInner; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/package-info.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/package-info.java new file mode 100644 index 000000000000..f1efc474c446 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// 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 CommvaultContentStore. + */ +package com.azure.resourcemanager.commvaultcontentstore.fluent.models; diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/package-info.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/package-info.java new file mode 100644 index 000000000000..4571843b10a6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/package-info.java @@ -0,0 +1,8 @@ +// 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 CommvaultContentStore. + */ +package com.azure.resourcemanager.commvaultcontentstore.fluent; diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/BackupProtectionGroupResponseImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/BackupProtectionGroupResponseImpl.java new file mode 100644 index 000000000000..a971eea54b9a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/BackupProtectionGroupResponseImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupResponse; +import java.util.Collections; +import java.util.List; + +public final class BackupProtectionGroupResponseImpl implements BackupProtectionGroupResponse { + private BackupProtectionGroupResponseInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + BackupProtectionGroupResponseImpl(BackupProtectionGroupResponseInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int taskId() { + return this.innerModel().taskId(); + } + + public List jobIds() { + List inner = this.innerModel().jobIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public BackupProtectionGroupResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountImpl.java new file mode 100644 index 000000000000..83b49e9eb9ab --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CloudAccountInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccount; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdate; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdateProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.LatestLinkedSaaSResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; +import java.util.Collections; +import java.util.Map; + +public final class CloudAccountImpl implements CloudAccount, CloudAccount.Definition, CloudAccount.Update { + private CloudAccountInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager 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 CloudAccountProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + 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 CloudAccountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudAccountName; + + private CloudAccountUpdate updateProperties; + + public CloudAccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CloudAccount create() { + this.innerObject = serviceManager.serviceClient() + .getCloudAccounts() + .createOrUpdate(resourceGroupName, cloudAccountName, this.innerModel(), Context.NONE); + return this; + } + + public CloudAccount create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudAccounts() + .createOrUpdate(resourceGroupName, cloudAccountName, this.innerModel(), context); + return this; + } + + CloudAccountImpl(String name, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = new CloudAccountInner(); + this.serviceManager = serviceManager; + this.cloudAccountName = name; + } + + public CloudAccountImpl update() { + this.updateProperties = new CloudAccountUpdate(); + return this; + } + + public CloudAccount apply() { + this.innerObject = serviceManager.serviceClient() + .getCloudAccounts() + .update(resourceGroupName, cloudAccountName, updateProperties, Context.NONE); + return this; + } + + public CloudAccount apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudAccounts() + .update(resourceGroupName, cloudAccountName, updateProperties, context); + return this; + } + + CloudAccountImpl(CloudAccountInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudAccountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cloudAccounts"); + } + + public CloudAccount refresh() { + this.innerObject = serviceManager.serviceClient() + .getCloudAccounts() + .getByResourceGroupWithResponse(resourceGroupName, cloudAccountName, Context.NONE) + .getValue(); + return this; + } + + public CloudAccount refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudAccounts() + .getByResourceGroupWithResponse(resourceGroupName, cloudAccountName, context) + .getValue(); + return this; + } + + public CloudAccount linkSaaS(SaaSData body) { + return serviceManager.cloudAccounts().linkSaaS(resourceGroupName, cloudAccountName, body); + } + + public CloudAccount linkSaaS(SaaSData body, Context context) { + return serviceManager.cloudAccounts().linkSaaS(resourceGroupName, cloudAccountName, body, context); + } + + public Response latestLinkedSaaSWithResponse(Context context) { + return serviceManager.cloudAccounts() + .latestLinkedSaaSWithResponse(resourceGroupName, cloudAccountName, context); + } + + public LatestLinkedSaaSResponse latestLinkedSaaS() { + return serviceManager.cloudAccounts().latestLinkedSaaS(resourceGroupName, cloudAccountName); + } + + public CloudAccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CloudAccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CloudAccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public CloudAccountImpl withProperties(CloudAccountProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public CloudAccountImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public CloudAccountImpl withProperties(CloudAccountUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsClientImpl.java new file mode 100644 index 000000000000..775ab36bb5c4 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsClientImpl.java @@ -0,0 +1,1393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.commvaultcontentstore.fluent.CloudAccountsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CloudAccountInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.CloudAccountListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdate; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; +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 CloudAccountsClient. + */ +public final class CloudAccountsClientImpl implements CloudAccountsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CloudAccountsService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of CloudAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudAccountsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service + = RestProxy.create(CloudAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientCloudAccounts to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientCloudAccounts") + public interface CloudAccountsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @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("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @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("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CloudAccountInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CloudAccountInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CloudAccountUpdate properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CloudAccountUpdate properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts") + @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/Commvault.ContentStore/cloudAccounts") + @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/Commvault.ContentStore/cloudAccounts") + @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/Commvault.ContentStore/cloudAccounts") + @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); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/linkSaaS") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> linkSaaS(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SaaSData body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/linkSaaS") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response linkSaaSSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SaaSData body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/latestLinkedSaaS") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> latestLinkedSaaS(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/latestLinkedSaaS") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response latestLinkedSaaSSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @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); + } + + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cloudAccountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudAccountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String cloudAccountName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context); + } + + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner getByResourceGroup(String resourceGroupName, String cloudAccountName) { + return getByResourceGroupWithResponse(resourceGroupName, cloudAccountName, Context.NONE).getValue(); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String cloudAccountName, CloudAccountInner resource) { + 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, cloudAccountName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + CloudAccountInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Cloud Account Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + CloudAccountInner resource, 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, cloudAccountName, contentType, accept, resource, + context); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudAccountInner> + beginCreateOrUpdateAsync(String resourceGroupName, String cloudAccountName, CloudAccountInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, cloudAccountName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudAccountInner.class, CloudAccountInner.class, this.client.getContext()); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudAccountInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, cloudAccountName, resource); + return this.client.getLroResult(response, CloudAccountInner.class, + CloudAccountInner.class, Context.NONE); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudAccountInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, cloudAccountName, resource, context); + return this.client.getLroResult(response, CloudAccountInner.class, + CloudAccountInner.class, context); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudAccountName, + CloudAccountInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudAccountName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner createOrUpdate(String resourceGroupName, String cloudAccountName, + CloudAccountInner resource) { + return beginCreateOrUpdate(resourceGroupName, cloudAccountName, resource).getFinalResult(); + } + + /** + * Create a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner createOrUpdate(String resourceGroupName, String cloudAccountName, + CloudAccountInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, cloudAccountName, resource, context).getFinalResult(); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String cloudAccountName, + CloudAccountUpdate properties) { + 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, cloudAccountName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String cloudAccountName, + CloudAccountUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Cloud Account Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String cloudAccountName, + CloudAccountUpdate properties, 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, cloudAccountName, contentType, accept, properties, + context); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link PollerFlux} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudAccountInner> beginUpdateAsync(String resourceGroupName, + String cloudAccountName, CloudAccountUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, cloudAccountName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudAccountInner.class, CloudAccountInner.class, this.client.getContext()); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link SyncPoller} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudAccountInner> beginUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountUpdate properties) { + Response response = updateWithResponse(resourceGroupName, cloudAccountName, properties); + return this.client.getLroResult(response, CloudAccountInner.class, + CloudAccountInner.class, Context.NONE); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudAccountInner> beginUpdate(String resourceGroupName, + String cloudAccountName, CloudAccountUpdate properties, Context context) { + Response response = updateWithResponse(resourceGroupName, cloudAccountName, properties, context); + return this.client.getLroResult(response, CloudAccountInner.class, + CloudAccountInner.class, context); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cloudAccountName, + CloudAccountUpdate properties) { + return beginUpdateAsync(resourceGroupName, cloudAccountName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner update(String resourceGroupName, String cloudAccountName, CloudAccountUpdate properties) { + return beginUpdate(resourceGroupName, cloudAccountName, properties).getFinalResult(); + } + + /** + * Update a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Cloud Account Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner update(String resourceGroupName, String cloudAccountName, CloudAccountUpdate properties, + Context context) { + return beginUpdate(resourceGroupName, cloudAccountName, properties, context).getFinalResult(); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String cloudAccountName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, Context.NONE); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, context); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudAccountName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName) { + return beginDeleteAsync(resourceGroupName, cloudAccountName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName) { + beginDelete(resourceGroupName, cloudAccountName).getFinalResult(); + } + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudAccountName, Context context) { + beginDelete(resourceGroupName, cloudAccountName, context).getFinalResult(); + } + + /** + * List CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount 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 CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount 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 CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount 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 CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount 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 CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount 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 CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount 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 CloudAccount resources by subscription ID. + * + * @throws ManagementException 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 CloudAccount 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 CloudAccount resources by subscription ID. + * + * @throws ManagementException 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 CloudAccount list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List CloudAccount resources by subscription ID. + * + * @throws ManagementException 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 CloudAccount 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 CloudAccount resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CloudAccount 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 CloudAccount resources by subscription ID. + * + * @throws ManagementException 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 CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List CloudAccount resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CloudAccount 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)); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> linkSaaSWithResponseAsync(String resourceGroupName, + String cloudAccountName, SaaSData body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.linkSaaS(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkSaaSWithResponse(String resourceGroupName, String cloudAccountName, + SaaSData body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.linkSaaSSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, contentType, accept, body, + Context.NONE); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkSaaSWithResponse(String resourceGroupName, String cloudAccountName, SaaSData body, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.linkSaaSSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, contentType, accept, body, context); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudAccountInner> beginLinkSaaSAsync(String resourceGroupName, + String cloudAccountName, SaaSData body) { + Mono>> mono = linkSaaSWithResponseAsync(resourceGroupName, cloudAccountName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudAccountInner.class, CloudAccountInner.class, this.client.getContext()); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudAccountInner> beginLinkSaaS(String resourceGroupName, + String cloudAccountName, SaaSData body) { + Response response = linkSaaSWithResponse(resourceGroupName, cloudAccountName, body); + return this.client.getLroResult(response, CloudAccountInner.class, + CloudAccountInner.class, Context.NONE); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudAccountInner> beginLinkSaaS(String resourceGroupName, + String cloudAccountName, SaaSData body, Context context) { + Response response = linkSaaSWithResponse(resourceGroupName, cloudAccountName, body, context); + return this.client.getLroResult(response, CloudAccountInner.class, + CloudAccountInner.class, context); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkSaaSAsync(String resourceGroupName, String cloudAccountName, SaaSData body) { + return beginLinkSaaSAsync(resourceGroupName, cloudAccountName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body) { + return beginLinkSaaS(resourceGroupName, cloudAccountName, body).getFinalResult(); + } + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudAccountInner linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body, + Context context) { + return beginLinkSaaS(resourceGroupName, cloudAccountName, body, context).getFinalResult(); + } + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> latestLinkedSaaSWithResponseAsync(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.latestLinkedSaaS(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono latestLinkedSaaSAsync(String resourceGroupName, + String cloudAccountName) { + return latestLinkedSaaSWithResponseAsync(resourceGroupName, cloudAccountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response latestLinkedSaaSWithResponse(String resourceGroupName, + String cloudAccountName, Context context) { + final String accept = "application/json"; + return service.latestLinkedSaaSSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context); + } + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LatestLinkedSaaSResponseInner latestLinkedSaaS(String resourceGroupName, String cloudAccountName) { + return latestLinkedSaaSWithResponse(resourceGroupName, cloudAccountName, Context.NONE).getValue(); + } + + /** + * 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 CloudAccount 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 CloudAccount 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 CloudAccount 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 CloudAccount 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 CloudAccount 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 CloudAccount 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); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsImpl.java new file mode 100644 index 000000000000..a625b733d66f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.CloudAccountsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CloudAccountInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccount; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccounts; +import com.azure.resourcemanager.commvaultcontentstore.models.LatestLinkedSaaSResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; + +public final class CloudAccountsImpl implements CloudAccounts { + private static final ClientLogger LOGGER = new ClientLogger(CloudAccountsImpl.class); + + private final CloudAccountsClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public CloudAccountsImpl(CloudAccountsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String cloudAccountName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cloudAccountName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CloudAccountImpl(inner.getValue(), this.manager())); + } + + public CloudAccount getByResourceGroup(String resourceGroupName, String cloudAccountName) { + CloudAccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cloudAccountName); + if (inner != null) { + return new CloudAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String cloudAccountName) { + this.serviceClient().delete(resourceGroupName, cloudAccountName); + } + + public void delete(String resourceGroupName, String cloudAccountName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudAccountImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudAccountImpl(inner1, this.manager())); + } + + public CloudAccount linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body) { + CloudAccountInner inner = this.serviceClient().linkSaaS(resourceGroupName, cloudAccountName, body); + if (inner != null) { + return new CloudAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public CloudAccount linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body, Context context) { + CloudAccountInner inner = this.serviceClient().linkSaaS(resourceGroupName, cloudAccountName, body, context); + if (inner != null) { + return new CloudAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response latestLinkedSaaSWithResponse(String resourceGroupName, + String cloudAccountName, Context context) { + Response inner + = this.serviceClient().latestLinkedSaaSWithResponse(resourceGroupName, cloudAccountName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new LatestLinkedSaaSResponseImpl(inner.getValue(), this.manager())); + } + + public LatestLinkedSaaSResponse latestLinkedSaaS(String resourceGroupName, String cloudAccountName) { + LatestLinkedSaaSResponseInner inner + = this.serviceClient().latestLinkedSaaS(resourceGroupName, cloudAccountName); + if (inner != null) { + return new LatestLinkedSaaSResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public CloudAccount 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudAccountName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudAccountName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, Context.NONE); + } + + public void deleteByIdWithResponse(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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, context); + } + + private CloudAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + public CloudAccountImpl define(String name) { + return new CloudAccountImpl(name, this.manager()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientBuilder.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientBuilder.java new file mode 100644 index 000000000000..9914ea4c8416 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientBuilder.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.commvaultcontentstore.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 CommvaultContentStoreManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { CommvaultContentStoreManagementClientImpl.class }) +public final class CommvaultContentStoreManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the CommvaultContentStoreManagementClientBuilder. + */ + public CommvaultContentStoreManagementClientBuilder 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 CommvaultContentStoreManagementClientBuilder. + */ + public CommvaultContentStoreManagementClientBuilder 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 CommvaultContentStoreManagementClientBuilder. + */ + public CommvaultContentStoreManagementClientBuilder 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 CommvaultContentStoreManagementClientBuilder. + */ + public CommvaultContentStoreManagementClientBuilder 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 CommvaultContentStoreManagementClientBuilder. + */ + public CommvaultContentStoreManagementClientBuilder 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 CommvaultContentStoreManagementClientBuilder. + */ + public CommvaultContentStoreManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CommvaultContentStoreManagementClientImpl with the provided parameters. + * + * @return an instance of CommvaultContentStoreManagementClientImpl. + */ + public CommvaultContentStoreManagementClientImpl 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(); + CommvaultContentStoreManagementClientImpl client = new CommvaultContentStoreManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientImpl.java new file mode 100644 index 000000000000..adf276d71d42 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientImpl.java @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.CloudAccountsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.CommvaultContentStoreManagementClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.OperationsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsOperationGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.SaaSOperationGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient; +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 CommvaultContentStoreManagementClientImpl type. + */ +@ServiceClient(builder = CommvaultContentStoreManagementClientBuilder.class) +public final class CommvaultContentStoreManagementClientImpl implements CommvaultContentStoreManagementClient { + /** + * 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 CloudAccountsClient object to access its operations. + */ + private final CloudAccountsClient cloudAccounts; + + /** + * Gets the CloudAccountsClient object to access its operations. + * + * @return the CloudAccountsClient object. + */ + public CloudAccountsClient getCloudAccounts() { + return this.cloudAccounts; + } + + /** + * The SaaSOperationGroupsClient object to access its operations. + */ + private final SaaSOperationGroupsClient saaSOperationGroups; + + /** + * Gets the SaaSOperationGroupsClient object to access its operations. + * + * @return the SaaSOperationGroupsClient object. + */ + public SaaSOperationGroupsClient getSaaSOperationGroups() { + return this.saaSOperationGroups; + } + + /** + * The StoragesClient object to access its operations. + */ + private final StoragesClient storages; + + /** + * Gets the StoragesClient object to access its operations. + * + * @return the StoragesClient object. + */ + public StoragesClient getStorages() { + return this.storages; + } + + /** + * The PlansClient object to access its operations. + */ + private final PlansClient plans; + + /** + * Gets the PlansClient object to access its operations. + * + * @return the PlansClient object. + */ + public PlansClient getPlans() { + return this.plans; + } + + /** + * The ProtectionGroupsClient object to access its operations. + */ + private final ProtectionGroupsClient protectionGroups; + + /** + * Gets the ProtectionGroupsClient object to access its operations. + * + * @return the ProtectionGroupsClient object. + */ + public ProtectionGroupsClient getProtectionGroups() { + return this.protectionGroups; + } + + /** + * The ProtectedItemsClient object to access its operations. + */ + private final ProtectedItemsClient protectedItems; + + /** + * Gets the ProtectedItemsClient object to access its operations. + * + * @return the ProtectedItemsClient object. + */ + public ProtectedItemsClient getProtectedItems() { + return this.protectedItems; + } + + /** + * The ProtectedItemsOperationGroupsClient object to access its operations. + */ + private final ProtectedItemsOperationGroupsClient protectedItemsOperationGroups; + + /** + * Gets the ProtectedItemsOperationGroupsClient object to access its operations. + * + * @return the ProtectedItemsOperationGroupsClient object. + */ + public ProtectedItemsOperationGroupsClient getProtectedItemsOperationGroups() { + return this.protectedItemsOperationGroups; + } + + /** + * The RoleMappingsClient object to access its operations. + */ + private final RoleMappingsClient roleMappings; + + /** + * Gets the RoleMappingsClient object to access its operations. + * + * @return the RoleMappingsClient object. + */ + public RoleMappingsClient getRoleMappings() { + return this.roleMappings; + } + + /** + * Initializes an instance of CommvaultContentStoreManagementClient 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. + */ + CommvaultContentStoreManagementClientImpl(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-07-03-preview"; + this.operations = new OperationsClientImpl(this); + this.cloudAccounts = new CloudAccountsClientImpl(this); + this.saaSOperationGroups = new SaaSOperationGroupsClientImpl(this); + this.storages = new StoragesClientImpl(this); + this.plans = new PlansClientImpl(this); + this.protectionGroups = new ProtectionGroupsClientImpl(this); + this.protectedItems = new ProtectedItemsClientImpl(this); + this.protectedItemsOperationGroups = new ProtectedItemsOperationGroupsClientImpl(this); + this.roleMappings = new RoleMappingsClientImpl(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(CommvaultContentStoreManagementClientImpl.class); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultPlanImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultPlanImpl.java new file mode 100644 index 000000000000..439938dc6e61 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultPlanImpl.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CommvaultPlan; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; + +public final class CommvaultPlanImpl implements CommvaultPlan, CommvaultPlan.Definition, CommvaultPlan.Update { + private CommvaultPlanInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PlanProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CommvaultPlanInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudAccountName; + + private String planName; + + public CommvaultPlanImpl withExistingCloudAccount(String resourceGroupName, String cloudAccountName) { + this.resourceGroupName = resourceGroupName; + this.cloudAccountName = cloudAccountName; + return this; + } + + public CommvaultPlan create() { + this.innerObject = serviceManager.serviceClient() + .getPlans() + .createOrupdate(resourceGroupName, cloudAccountName, planName, this.innerModel(), Context.NONE); + return this; + } + + public CommvaultPlan create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPlans() + .createOrupdate(resourceGroupName, cloudAccountName, planName, this.innerModel(), context); + return this; + } + + CommvaultPlanImpl(String name, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = new CommvaultPlanInner(); + this.serviceManager = serviceManager; + this.planName = name; + } + + public CommvaultPlanImpl update() { + return this; + } + + public CommvaultPlan apply() { + this.innerObject = serviceManager.serviceClient() + .getPlans() + .createOrupdate(resourceGroupName, cloudAccountName, planName, this.innerModel(), Context.NONE); + return this; + } + + public CommvaultPlan apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPlans() + .createOrupdate(resourceGroupName, cloudAccountName, planName, this.innerModel(), context); + return this; + } + + CommvaultPlanImpl(CommvaultPlanInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudAccountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cloudAccounts"); + this.planName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "plans"); + } + + public CommvaultPlan refresh() { + this.innerObject = serviceManager.serviceClient() + .getPlans() + .getWithResponse(resourceGroupName, cloudAccountName, planName, Context.NONE) + .getValue(); + return this; + } + + public CommvaultPlan refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPlans() + .getWithResponse(resourceGroupName, cloudAccountName, planName, context) + .getValue(); + return this; + } + + public CommvaultPlanImpl withProperties(PlanProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CountProtectedItemsResponseImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CountProtectedItemsResponseImpl.java new file mode 100644 index 000000000000..5df652653a49 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CountProtectedItemsResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsResponse; + +public final class CountProtectedItemsResponseImpl implements CountProtectedItemsResponse { + private CountProtectedItemsResponseInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + CountProtectedItemsResponseImpl(CountProtectedItemsResponseInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String count() { + return this.innerModel().count(); + } + + public CountProtectedItemsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/LatestLinkedSaaSResponseImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/LatestLinkedSaaSResponseImpl.java new file mode 100644 index 000000000000..1ad7a93de4cf --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/LatestLinkedSaaSResponseImpl.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.commvaultcontentstore.implementation; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.LatestLinkedSaaSResponse; + +public final class LatestLinkedSaaSResponseImpl implements LatestLinkedSaaSResponse { + private LatestLinkedSaaSResponseInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + LatestLinkedSaaSResponseImpl(LatestLinkedSaaSResponseInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String saaSResourceId() { + return this.innerModel().saaSResourceId(); + } + + public Boolean isHiddenSaaS() { + return this.innerModel().isHiddenSaaS(); + } + + public LatestLinkedSaaSResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationImpl.java new file mode 100644 index 000000000000..9e5c9ab0e9d8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationImpl.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.commvaultcontentstore.implementation; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.OperationInner; +import com.azure.resourcemanager.commvaultcontentstore.models.ActionType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operation; +import com.azure.resourcemanager.commvaultcontentstore.models.OperationDisplay; +import com.azure.resourcemanager.commvaultcontentstore.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager 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.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..4a7413b278f0 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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.commvaultcontentstore.fluent.OperationsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.OperationInner; +import com.azure.resourcemanager.commvaultcontentstore.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 CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Commvault.ContentStore/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/Commvault.ContentStore/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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsImpl.java new file mode 100644 index 000000000000..562d47c5fbb7 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.OperationsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.OperationInner; +import com.azure.resourcemanager.commvaultcontentstore.models.Operation; +import com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager 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.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansClientImpl.java new file mode 100644 index 000000000000..f0a31e0f2c43 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansClientImpl.java @@ -0,0 +1,767 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.commvaultcontentstore.fluent.PlansClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.CommvaultPlanListResult; +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 PlansClient. + */ +public final class PlansClientImpl implements PlansClient { + /** + * The proxy service used to perform REST calls. + */ + private final PlansService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of PlansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PlansClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service = RestProxy.create(PlansService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientPlans to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientPlans") + public interface PlansService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans/{planName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("planName") String planName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans/{planName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("planName") String planName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans/{planName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("planName") String planName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommvaultPlanInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans/{planName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("planName") String planName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommvaultPlanInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans/{planName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("planName") String planName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans/{planName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("planName") String planName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudAccount(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/plans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCloudAccountSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudAccountNext( + @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 listByCloudAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String cloudAccountName, + String planName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, planName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudAccountName, String planName) { + return getWithResponseAsync(resourceGroupName, cloudAccountName, planName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String cloudAccountName, + String planName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, cloudAccountName, planName, accept, context); + } + + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommvaultPlanInner get(String resourceGroupName, String cloudAccountName, String planName) { + return getWithResponse(resourceGroupName, cloudAccountName, planName, Context.NONE).getValue(); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrupdateWithResponseAsync(String resourceGroupName, + String cloudAccountName, String planName, CommvaultPlanInner resource) { + 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, cloudAccountName, planName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrupdateWithResponse(String resourceGroupName, String cloudAccountName, + String planName, CommvaultPlanInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrupdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, planName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Plan Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrupdateWithResponse(String resourceGroupName, String cloudAccountName, + String planName, CommvaultPlanInner resource, 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, cloudAccountName, planName, contentType, accept, + resource, context); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommvaultPlanInner> beginCreateOrupdateAsync( + String resourceGroupName, String cloudAccountName, String planName, CommvaultPlanInner resource) { + Mono>> mono + = createOrupdateWithResponseAsync(resourceGroupName, cloudAccountName, planName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CommvaultPlanInner.class, CommvaultPlanInner.class, this.client.getContext()); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommvaultPlanInner> beginCreateOrupdate(String resourceGroupName, + String cloudAccountName, String planName, CommvaultPlanInner resource) { + Response response + = createOrupdateWithResponse(resourceGroupName, cloudAccountName, planName, resource); + return this.client.getLroResult(response, CommvaultPlanInner.class, + CommvaultPlanInner.class, Context.NONE); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommvaultPlanInner> beginCreateOrupdate(String resourceGroupName, + String cloudAccountName, String planName, CommvaultPlanInner resource, Context context) { + Response response + = createOrupdateWithResponse(resourceGroupName, cloudAccountName, planName, resource, context); + return this.client.getLroResult(response, CommvaultPlanInner.class, + CommvaultPlanInner.class, context); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrupdateAsync(String resourceGroupName, String cloudAccountName, + String planName, CommvaultPlanInner resource) { + return beginCreateOrupdateAsync(resourceGroupName, cloudAccountName, planName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommvaultPlanInner createOrupdate(String resourceGroupName, String cloudAccountName, String planName, + CommvaultPlanInner resource) { + return beginCreateOrupdate(resourceGroupName, cloudAccountName, planName, resource).getFinalResult(); + } + + /** + * Create a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommvaultPlanInner createOrupdate(String resourceGroupName, String cloudAccountName, String planName, + CommvaultPlanInner resource, Context context) { + return beginCreateOrupdate(resourceGroupName, cloudAccountName, planName, resource, context).getFinalResult(); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String cloudAccountName, + String planName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, planName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, + String planName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, planName, Context.NONE); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, String planName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, planName, context); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 cloudAccountName, + String planName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudAccountName, planName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 cloudAccountName, + String planName) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName, planName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, + String planName, Context context) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName, planName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 cloudAccountName, String planName) { + return beginDeleteAsync(resourceGroupName, cloudAccountName, planName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 cloudAccountName, String planName) { + beginDelete(resourceGroupName, cloudAccountName, planName).getFinalResult(); + } + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudAccountName, String planName, Context context) { + beginDelete(resourceGroupName, cloudAccountName, planName, context).getFinalResult(); + } + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudAccountSinglePageAsync(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCloudAccount(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, 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 CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudAccountAsync(String resourceGroupName, String cloudAccountName) { + return new PagedFlux<>(() -> listByCloudAccountSinglePageAsync(resourceGroupName, cloudAccountName), + nextLink -> listByCloudAccountNextSinglePageAsync(nextLink)); + } + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountSinglePage(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountSinglePage(String resourceGroupName, + String cloudAccountName, Context context) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName) { + return new PagedIterable<>(() -> listByCloudAccountSinglePage(resourceGroupName, cloudAccountName), + nextLink -> listByCloudAccountNextSinglePage(nextLink)); + } + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context) { + return new PagedIterable<>(() -> listByCloudAccountSinglePage(resourceGroupName, cloudAccountName, context), + nextLink -> listByCloudAccountNextSinglePage(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 CommvaultPlan list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudAccountNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudAccountNext(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 CommvaultPlan list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountNextSync(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 CommvaultPlan list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountNextSync(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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansImpl.java new file mode 100644 index 000000000000..ae8eb9e08260 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.PlansClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CommvaultPlan; +import com.azure.resourcemanager.commvaultcontentstore.models.Plans; + +public final class PlansImpl implements Plans { + private static final ClientLogger LOGGER = new ClientLogger(PlansImpl.class); + + private final PlansClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public PlansImpl(PlansClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudAccountName, String planName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudAccountName, planName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CommvaultPlanImpl(inner.getValue(), this.manager())); + } + + public CommvaultPlan get(String resourceGroupName, String cloudAccountName, String planName) { + CommvaultPlanInner inner = this.serviceClient().get(resourceGroupName, cloudAccountName, planName); + if (inner != null) { + return new CommvaultPlanImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String cloudAccountName, String planName) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, planName); + } + + public void delete(String resourceGroupName, String cloudAccountName, String planName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, planName, context); + } + + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName) { + PagedIterable inner + = this.serviceClient().listByCloudAccount(resourceGroupName, cloudAccountName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommvaultPlanImpl(inner1, this.manager())); + } + + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context) { + PagedIterable inner + = this.serviceClient().listByCloudAccount(resourceGroupName, cloudAccountName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommvaultPlanImpl(inner1, this.manager())); + } + + public CommvaultPlan 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String planName = ResourceManagerUtils.getValueFromIdByName(id, "plans"); + if (planName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'plans'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudAccountName, planName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String planName = ResourceManagerUtils.getValueFromIdByName(id, "plans"); + if (planName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'plans'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudAccountName, planName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String planName = ResourceManagerUtils.getValueFromIdByName(id, "plans"); + if (planName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'plans'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, planName, Context.NONE); + } + + public void deleteByIdWithResponse(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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String planName = ResourceManagerUtils.getValueFromIdByName(id, "plans"); + if (planName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'plans'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, planName, context); + } + + private PlansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + public CommvaultPlanImpl define(String name) { + return new CommvaultPlanImpl(name, this.manager()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemImpl.java new file mode 100644 index 000000000000..a9921657cb5e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItem; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItemProperties; + +public final class ProtectedItemImpl implements ProtectedItem { + private ProtectedItemInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + ProtectedItemImpl(ProtectedItemInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager 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 ProtectedItemProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProtectedItemInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsClientImpl.java new file mode 100644 index 000000000000..2033cc17eb0c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsClientImpl.java @@ -0,0 +1,647 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +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.commvaultcontentstore.fluent.ProtectedItemsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.ProtectedItemListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProtectedItemsClient. + */ +public final class ProtectedItemsClientImpl implements ProtectedItemsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProtectedItemsService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of ProtectedItemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProtectedItemsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service + = RestProxy.create(ProtectedItemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientProtectedItems to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientProtectedItems") + public interface ProtectedItemsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems/{protectedItemName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @PathParam("protectedItemName") String protectedItemName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems/{protectedItemName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @PathParam("protectedItemName") String protectedItemName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProtectionGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByProtectionGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems/{protectedItemName}/getRestorePoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getRestorePoints(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @PathParam("protectedItemName") String protectedItemName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems/{protectedItemName}/getRestorePoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getRestorePointsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @PathParam("protectedItemName") String protectedItemName, @HeaderParam("Accept") String accept, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems/{protectedItemName}/restore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> restore(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @PathParam("protectedItemName") String protectedItemName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RestoreProtectionItemRequest request, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/protectedItems/{protectedItemName}/restore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response restoreSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @PathParam("protectedItemName") String protectedItemName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RestoreProtectionItemRequest request, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProtectionGroupNext( + @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 listByProtectionGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, + protectedItemName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName) { + return getWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, accept, context); + } + + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProtectedItemInner get(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName) { + return getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, + Context.NONE).getValue(); + } + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProtectionGroupSinglePageAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByProtectionGroup(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, + protectionGroupName, 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 ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProtectionGroupAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return new PagedFlux<>( + () -> listByProtectionGroupSinglePageAsync(resourceGroupName, cloudAccountName, protectionGroupName), + nextLink -> listByProtectionGroupNextSinglePageAsync(nextLink)); + } + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByProtectionGroupSinglePage(String resourceGroupName, + String cloudAccountName, String protectionGroupName) { + final String accept = "application/json"; + Response res = service.listByProtectionGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, + protectionGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByProtectionGroupSinglePage(String resourceGroupName, + String cloudAccountName, String protectionGroupName, Context context) { + final String accept = "application/json"; + Response res = service.listByProtectionGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, + protectionGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return new PagedIterable<>( + () -> listByProtectionGroupSinglePage(resourceGroupName, cloudAccountName, protectionGroupName), + nextLink -> listByProtectionGroupNextSinglePage(nextLink)); + } + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + return new PagedIterable<>( + () -> listByProtectionGroupSinglePage(resourceGroupName, cloudAccountName, protectionGroupName, context), + nextLink -> listByProtectionGroupNextSinglePage(nextLink, context)); + } + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRestorePointsWithResponseAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName, String protectedItemName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getRestorePoints(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, + protectedItemName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRestorePointsAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName) { + return getRestorePointsWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, + protectedItemName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRestorePointsWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context) { + final String accept = "application/json"; + return service.getRestorePointsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, + protectedItemName, accept, context); + } + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointsInner getRestorePoints(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName) { + return getRestorePointsWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, + Context.NONE).getValue(); + } + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> restoreWithResponseAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName, String protectedItemName, + RestoreProtectionItemRequest request) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.restore(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, + protectedItemName, contentType, accept, request, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restoreAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, RestoreProtectionItemRequest request) { + return restoreWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, + request).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response restoreWithResponse(String resourceGroupName, + String cloudAccountName, String protectionGroupName, String protectedItemName, + RestoreProtectionItemRequest request, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.restoreSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, + protectedItemName, contentType, accept, request, context); + } + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreProtectionItemResponseInner restore(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, RestoreProtectionItemRequest request) { + return restoreWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, request, + Context.NONE).getValue(); + } + + /** + * 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 ProtectedItem list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProtectionGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByProtectionGroupNext(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 ProtectedItem list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByProtectionGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByProtectionGroupNextSync(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 ProtectedItem list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByProtectionGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByProtectionGroupNextSync(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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsImpl.java new file mode 100644 index 000000000000..c71b15955748 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.ProtectedItemsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItem; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItems; +import com.azure.resourcemanager.commvaultcontentstore.models.RestorePoints; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemResponse; + +public final class ProtectedItemsImpl implements ProtectedItems { + private static final ClientLogger LOGGER = new ClientLogger(ProtectedItemsImpl.class); + + private final ProtectedItemsClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public ProtectedItemsImpl(ProtectedItemsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ProtectedItemImpl(inner.getValue(), this.manager())); + } + + public ProtectedItem get(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName) { + ProtectedItemInner inner + = this.serviceClient().get(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName); + if (inner != null) { + return new ProtectedItemImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + PagedIterable inner + = this.serviceClient().listByProtectionGroup(resourceGroupName, cloudAccountName, protectionGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProtectedItemImpl(inner1, this.manager())); + } + + public PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + PagedIterable inner = this.serviceClient() + .listByProtectionGroup(resourceGroupName, cloudAccountName, protectionGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProtectedItemImpl(inner1, this.manager())); + } + + public Response getRestorePointsWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context) { + Response inner = this.serviceClient() + .getRestorePointsWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RestorePointsImpl(inner.getValue(), this.manager())); + } + + public RestorePoints getRestorePoints(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName) { + RestorePointsInner inner = this.serviceClient() + .getRestorePoints(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName); + if (inner != null) { + return new RestorePointsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response restoreWithResponse(String resourceGroupName, + String cloudAccountName, String protectionGroupName, String protectedItemName, + RestoreProtectionItemRequest request, Context context) { + Response inner = this.serviceClient() + .restoreWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, request, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RestoreProtectionItemResponseImpl(inner.getValue(), this.manager())); + } + + public RestoreProtectionItemResponse restore(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, RestoreProtectionItemRequest request) { + RestoreProtectionItemResponseInner inner = this.serviceClient() + .restore(resourceGroupName, cloudAccountName, protectionGroupName, protectedItemName, request); + if (inner != null) { + return new RestoreProtectionItemResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ProtectedItemsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsClientImpl.java new file mode 100644 index 000000000000..5e25fe85c8c7 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsClientImpl.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.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsOperationGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProtectedItemsOperationGroupsClient. + */ +public final class ProtectedItemsOperationGroupsClientImpl implements ProtectedItemsOperationGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProtectedItemsOperationGroupsService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of ProtectedItemsOperationGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProtectedItemsOperationGroupsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service = RestProxy.create(ProtectedItemsOperationGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientProtectedItemsOperationGroups to + * be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientProtectedItemsOperationGroups") + public interface ProtectedItemsOperationGroupsService { + @Post("/providers/Commvault.ContentStore/protectedItemCount") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> countByProtectionGroups(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CountProtectedItemsRequest body, + Context context); + + @Post("/providers/Commvault.ContentStore/protectedItemCount") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response countByProtectionGroupsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CountProtectedItemsRequest body, + Context context); + } + + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + countByProtectionGroupsWithResponseAsync(CountProtectedItemsRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.countByProtectionGroups(this.client.getEndpoint(), + this.client.getApiVersion(), contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono countByProtectionGroupsAsync(CountProtectedItemsRequest body) { + return countByProtectionGroupsWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + countByProtectionGroupsWithResponse(CountProtectedItemsRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.countByProtectionGroupsSync(this.client.getEndpoint(), this.client.getApiVersion(), contentType, + accept, body, context); + } + + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CountProtectedItemsResponseInner countByProtectionGroups(CountProtectedItemsRequest body) { + return countByProtectionGroupsWithResponse(body, Context.NONE).getValue(); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsImpl.java new file mode 100644 index 000000000000..aeb646d4258e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsOperationGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItemsOperationGroups; + +public final class ProtectedItemsOperationGroupsImpl implements ProtectedItemsOperationGroups { + private static final ClientLogger LOGGER = new ClientLogger(ProtectedItemsOperationGroupsImpl.class); + + private final ProtectedItemsOperationGroupsClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public ProtectedItemsOperationGroupsImpl(ProtectedItemsOperationGroupsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response countByProtectionGroupsWithResponse(CountProtectedItemsRequest body, + Context context) { + Response inner + = this.serviceClient().countByProtectionGroupsWithResponse(body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CountProtectedItemsResponseImpl(inner.getValue(), this.manager())); + } + + public CountProtectedItemsResponse countByProtectionGroups(CountProtectedItemsRequest body) { + CountProtectedItemsResponseInner inner = this.serviceClient().countByProtectionGroups(body); + if (inner != null) { + return new CountProtectedItemsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ProtectedItemsOperationGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupImpl.java new file mode 100644 index 000000000000..8f762cf1406e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroup; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; + +public final class ProtectionGroupImpl implements ProtectionGroup, ProtectionGroup.Definition, ProtectionGroup.Update { + private ProtectionGroupInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ProtectionGroupProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ProtectionGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudAccountName; + + private String protectionGroupName; + + public ProtectionGroupImpl withExistingCloudAccount(String resourceGroupName, String cloudAccountName) { + this.resourceGroupName = resourceGroupName; + this.cloudAccountName = cloudAccountName; + return this; + } + + public ProtectionGroup create() { + this.innerObject = serviceManager.serviceClient() + .getProtectionGroups() + .createOrupdate(resourceGroupName, cloudAccountName, protectionGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ProtectionGroup create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getProtectionGroups() + .createOrupdate(resourceGroupName, cloudAccountName, protectionGroupName, this.innerModel(), context); + return this; + } + + ProtectionGroupImpl(String name, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = new ProtectionGroupInner(); + this.serviceManager = serviceManager; + this.protectionGroupName = name; + } + + public ProtectionGroupImpl update() { + return this; + } + + public ProtectionGroup apply() { + this.innerObject = serviceManager.serviceClient() + .getProtectionGroups() + .createOrupdate(resourceGroupName, cloudAccountName, protectionGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ProtectionGroup apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getProtectionGroups() + .createOrupdate(resourceGroupName, cloudAccountName, protectionGroupName, this.innerModel(), context); + return this; + } + + ProtectionGroupImpl(ProtectionGroupInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudAccountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cloudAccounts"); + this.protectionGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "protectionGroups"); + } + + public ProtectionGroup refresh() { + this.innerObject = serviceManager.serviceClient() + .getProtectionGroups() + .getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, Context.NONE) + .getValue(); + return this; + } + + public ProtectionGroup refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getProtectionGroups() + .getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, context) + .getValue(); + return this; + } + + public void stopBackup(StopBackupProtectionGroupRequest request) { + serviceManager.protectionGroups().stopBackup(resourceGroupName, cloudAccountName, protectionGroupName, request); + } + + public void stopBackup(StopBackupProtectionGroupRequest request, Context context) { + serviceManager.protectionGroups() + .stopBackup(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + } + + public Response restoreWithResponse(RestoreProtectionItemRequest request, + Context context) { + return serviceManager.protectionGroups() + .restoreWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + } + + public RestoreProtectionItemResponse restore(RestoreProtectionItemRequest request) { + return serviceManager.protectionGroups() + .restore(resourceGroupName, cloudAccountName, protectionGroupName, request); + } + + public Response resumeBackupWithResponse(Context context) { + return serviceManager.protectionGroups() + .resumeBackupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, context); + } + + public void resumeBackup() { + serviceManager.protectionGroups().resumeBackup(resourceGroupName, cloudAccountName, protectionGroupName); + } + + public Response backupWithResponse(BackupProtectionGroupRequest request, + Context context) { + return serviceManager.protectionGroups() + .backupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + } + + public BackupProtectionGroupResponse backup(BackupProtectionGroupRequest request) { + return serviceManager.protectionGroups() + .backup(resourceGroupName, cloudAccountName, protectionGroupName, request); + } + + public ProtectionGroupImpl withProperties(ProtectionGroupProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsClientImpl.java new file mode 100644 index 000000000000..ae0d86aaad24 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsClientImpl.java @@ -0,0 +1,1296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.commvaultcontentstore.fluent.ProtectionGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.ProtectionGroupListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; +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 ProtectionGroupsClient. + */ +public final class ProtectionGroupsClientImpl implements ProtectionGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProtectionGroupsService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of ProtectionGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProtectionGroupsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service + = RestProxy.create(ProtectionGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientProtectionGroups to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientProtectionGroups") + public interface ProtectionGroupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ProtectionGroupInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ProtectionGroupInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudAccount(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCloudAccountSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/stopBackup") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stopBackup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") StopBackupProtectionGroupRequest request, Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/stopBackup") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response stopBackupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") StopBackupProtectionGroupRequest request, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/restore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> restore(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RestoreProtectionItemRequest request, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/restore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response restoreSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RestoreProtectionItemRequest request, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/resumeBackup") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resumeBackup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/resumeBackup") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resumeBackupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/backup") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> backup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BackupProtectionGroupRequest request, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/protectionGroups/{protectionGroupName}/backup") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response backupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, + @PathParam("protectionGroupName") String protectionGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BackupProtectionGroupRequest request, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudAccountNext( + @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 listByCloudAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return getWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, cloudAccountName, protectionGroupName, accept, context); + } + + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProtectionGroupInner get(String resourceGroupName, String cloudAccountName, String protectionGroupName) { + return getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, Context.NONE).getValue(); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrupdateWithResponseAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName, ProtectionGroupInner resource) { + 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, cloudAccountName, protectionGroupName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrupdateWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, ProtectionGroupInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrupdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + accept, resource, Context.NONE); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Plan Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrupdateWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, ProtectionGroupInner resource, 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, cloudAccountName, protectionGroupName, contentType, + accept, resource, context); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProtectionGroupInner> beginCreateOrupdateAsync( + String resourceGroupName, String cloudAccountName, String protectionGroupName, ProtectionGroupInner resource) { + Mono>> mono + = createOrupdateWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ProtectionGroupInner.class, ProtectionGroupInner.class, this.client.getContext()); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProtectionGroupInner> beginCreateOrupdate( + String resourceGroupName, String cloudAccountName, String protectionGroupName, ProtectionGroupInner resource) { + Response response + = createOrupdateWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, resource); + return this.client.getLroResult(response, + ProtectionGroupInner.class, ProtectionGroupInner.class, Context.NONE); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProtectionGroupInner> beginCreateOrupdate( + String resourceGroupName, String cloudAccountName, String protectionGroupName, ProtectionGroupInner resource, + Context context) { + Response response + = createOrupdateWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, resource, context); + return this.client.getLroResult(response, + ProtectionGroupInner.class, ProtectionGroupInner.class, context); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrupdateAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, ProtectionGroupInner resource) { + return beginCreateOrupdateAsync(resourceGroupName, cloudAccountName, protectionGroupName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProtectionGroupInner createOrupdate(String resourceGroupName, String cloudAccountName, + String protectionGroupName, ProtectionGroupInner resource) { + return beginCreateOrupdate(resourceGroupName, cloudAccountName, protectionGroupName, resource).getFinalResult(); + } + + /** + * Create a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Plan Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProtectionGroupInner createOrupdate(String resourceGroupName, String cloudAccountName, + String protectionGroupName, ProtectionGroupInner resource, Context context) { + return beginCreateOrupdate(resourceGroupName, cloudAccountName, protectionGroupName, resource, context) + .getFinalResult(); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, Context.NONE); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, context); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 cloudAccountName, + String protectionGroupName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 cloudAccountName, + String protectionGroupName) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName, protectionGroupName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 cloudAccountName, String protectionGroupName) { + return beginDeleteAsync(resourceGroupName, cloudAccountName, protectionGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 cloudAccountName, String protectionGroupName) { + beginDelete(resourceGroupName, cloudAccountName, protectionGroupName).getFinalResult(); + } + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudAccountName, String protectionGroupName, Context context) { + beginDelete(resourceGroupName, cloudAccountName, protectionGroupName, context).getFinalResult(); + } + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudAccountSinglePageAsync(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCloudAccount(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, 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 ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudAccountAsync(String resourceGroupName, String cloudAccountName) { + return new PagedFlux<>(() -> listByCloudAccountSinglePageAsync(resourceGroupName, cloudAccountName), + nextLink -> listByCloudAccountNextSinglePageAsync(nextLink)); + } + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountSinglePage(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountSinglePage(String resourceGroupName, + String cloudAccountName, Context context) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName) { + return new PagedIterable<>(() -> listByCloudAccountSinglePage(resourceGroupName, cloudAccountName), + nextLink -> listByCloudAccountNextSinglePage(nextLink)); + } + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context) { + return new PagedIterable<>(() -> listByCloudAccountSinglePage(resourceGroupName, cloudAccountName, context), + nextLink -> listByCloudAccountNextSinglePage(nextLink, context)); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopBackupWithResponseAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName, StopBackupProtectionGroupRequest request) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.stopBackup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + request, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response stopBackupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request) { + final String contentType = "application/json"; + return service.stopBackupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + request, Context.NONE); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response stopBackupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request, Context context) { + final String contentType = "application/json"; + return service.stopBackupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + request, context); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopBackupAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request) { + Mono>> mono + = stopBackupWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, request); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStopBackup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request) { + Response response + = stopBackupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStopBackup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, StopBackupProtectionGroupRequest request, Context context) { + Response response + = stopBackupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopBackupAsync(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request) { + return beginStopBackupAsync(resourceGroupName, cloudAccountName, protectionGroupName, request).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request) { + beginStopBackup(resourceGroupName, cloudAccountName, protectionGroupName, request).getFinalResult(); + } + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request, Context context) { + beginStopBackup(resourceGroupName, cloudAccountName, protectionGroupName, request, context).getFinalResult(); + } + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> restoreWithResponseAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName, RestoreProtectionItemRequest request) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.restore(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + accept, request, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restoreAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, RestoreProtectionItemRequest request) { + return restoreWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, request) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response restoreWithResponse(String resourceGroupName, + String cloudAccountName, String protectionGroupName, RestoreProtectionItemRequest request, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.restoreSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + accept, request, context); + } + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreProtectionItemResponseInner restore(String resourceGroupName, String cloudAccountName, + String protectionGroupName, RestoreProtectionItemRequest request) { + return restoreWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, Context.NONE) + .getValue(); + } + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resumeBackupWithResponseAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return FluxUtil + .withContext(context -> service.resumeBackup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 resumeBackupAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName) { + return resumeBackupWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resumeBackupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + return service.resumeBackupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, context); + } + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 resumeBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName) { + resumeBackupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, Context.NONE); + } + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> backupWithResponseAsync(String resourceGroupName, + String cloudAccountName, String protectionGroupName, BackupProtectionGroupRequest request) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.backup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + accept, request, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono backupAsync(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request) { + return backupWithResponseAsync(resourceGroupName, cloudAccountName, protectionGroupName, request) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response backupWithResponse(String resourceGroupName, + String cloudAccountName, String protectionGroupName, BackupProtectionGroupRequest request, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.backupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, protectionGroupName, contentType, + accept, request, context); + } + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupProtectionGroupResponseInner backup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request) { + return backupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, Context.NONE) + .getValue(); + } + + /** + * 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 ProtectionGroup list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudAccountNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudAccountNext(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 ProtectionGroup list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountNextSync(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 ProtectionGroup list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountNextSync(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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsImpl.java new file mode 100644 index 000000000000..019f28f821b8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.ProtectionGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroup; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroups; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; + +public final class ProtectionGroupsImpl implements ProtectionGroups { + private static final ClientLogger LOGGER = new ClientLogger(ProtectionGroupsImpl.class); + + private final ProtectionGroupsClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public ProtectionGroupsImpl(ProtectionGroupsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ProtectionGroupImpl(inner.getValue(), this.manager())); + } + + public ProtectionGroup get(String resourceGroupName, String cloudAccountName, String protectionGroupName) { + ProtectionGroupInner inner = this.serviceClient().get(resourceGroupName, cloudAccountName, protectionGroupName); + if (inner != null) { + return new ProtectionGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String cloudAccountName, String protectionGroupName) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, protectionGroupName); + } + + public void delete(String resourceGroupName, String cloudAccountName, String protectionGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, protectionGroupName, context); + } + + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName) { + PagedIterable inner + = this.serviceClient().listByCloudAccount(resourceGroupName, cloudAccountName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProtectionGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context) { + PagedIterable inner + = this.serviceClient().listByCloudAccount(resourceGroupName, cloudAccountName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProtectionGroupImpl(inner1, this.manager())); + } + + public void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request) { + this.serviceClient().stopBackup(resourceGroupName, cloudAccountName, protectionGroupName, request); + } + + public void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request, Context context) { + this.serviceClient().stopBackup(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + } + + public Response restoreWithResponse(String resourceGroupName, + String cloudAccountName, String protectionGroupName, RestoreProtectionItemRequest request, Context context) { + Response inner = this.serviceClient() + .restoreWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RestoreProtectionItemResponseImpl(inner.getValue(), this.manager())); + } + + public RestoreProtectionItemResponse restore(String resourceGroupName, String cloudAccountName, + String protectionGroupName, RestoreProtectionItemRequest request) { + RestoreProtectionItemResponseInner inner + = this.serviceClient().restore(resourceGroupName, cloudAccountName, protectionGroupName, request); + if (inner != null) { + return new RestoreProtectionItemResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response resumeBackupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context) { + return this.serviceClient() + .resumeBackupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, context); + } + + public void resumeBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName) { + this.serviceClient().resumeBackup(resourceGroupName, cloudAccountName, protectionGroupName); + } + + public Response backupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request, Context context) { + Response inner = this.serviceClient() + .backupWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, request, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BackupProtectionGroupResponseImpl(inner.getValue(), this.manager())); + } + + public BackupProtectionGroupResponse backup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request) { + BackupProtectionGroupResponseInner inner + = this.serviceClient().backup(resourceGroupName, cloudAccountName, protectionGroupName, request); + if (inner != null) { + return new BackupProtectionGroupResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ProtectionGroup 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String protectionGroupName = ResourceManagerUtils.getValueFromIdByName(id, "protectionGroups"); + if (protectionGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'protectionGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String protectionGroupName = ResourceManagerUtils.getValueFromIdByName(id, "protectionGroups"); + if (protectionGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'protectionGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudAccountName, protectionGroupName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String protectionGroupName = ResourceManagerUtils.getValueFromIdByName(id, "protectionGroups"); + if (protectionGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'protectionGroups'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, protectionGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String protectionGroupName = ResourceManagerUtils.getValueFromIdByName(id, "protectionGroups"); + if (protectionGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'protectionGroups'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, protectionGroupName, context); + } + + private ProtectionGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + public ProtectionGroupImpl define(String name) { + return new ProtectionGroupImpl(name, this.manager()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ResourceManagerUtils.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..9f6ce6f9df50 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestorePointsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestorePointsImpl.java new file mode 100644 index 000000000000..992b555354de --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestorePointsImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner; +import com.azure.resourcemanager.commvaultcontentstore.models.RestorePoints; +import java.util.Collections; +import java.util.List; + +public final class RestorePointsImpl implements RestorePoints { + private RestorePointsInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + RestorePointsImpl(RestorePointsInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List restoreTimes() { + List inner = this.innerModel().restoreTimes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestorePointsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestoreProtectionItemResponseImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestoreProtectionItemResponseImpl.java new file mode 100644 index 000000000000..e8ad67b486ef --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestoreProtectionItemResponseImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemResponse; +import java.util.Collections; +import java.util.List; + +public final class RestoreProtectionItemResponseImpl implements RestoreProtectionItemResponse { + private RestoreProtectionItemResponseInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + RestoreProtectionItemResponseImpl(RestoreProtectionItemResponseInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int taskId() { + return this.innerModel().taskId(); + } + + public List jobIds() { + List inner = this.innerModel().jobIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestoreProtectionItemResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingImpl.java new file mode 100644 index 000000000000..a2ce7f6a840f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMapping; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; + +public final class RoleMappingImpl implements RoleMapping { + private RoleMappingInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + RoleMappingImpl(RoleMappingInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager 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 RoleMappingProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public RoleMappingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsClientImpl.java new file mode 100644 index 000000000000..f8615b84236b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsClientImpl.java @@ -0,0 +1,541 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.RoleMappingListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RoleMappingsClient. + */ +public final class RoleMappingsClientImpl implements RoleMappingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final RoleMappingsService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of RoleMappingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RoleMappingsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service + = RestProxy.create(RoleMappingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientRoleMappings to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientRoleMappings") + public interface RoleMappingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings/default") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RoleMappingInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings/default") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RoleMappingInner resource, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings/default") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings/default") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/roleMappings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @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); + } + + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudAccountName) { + return getWithResponseAsync(resourceGroupName, cloudAccountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String cloudAccountName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, cloudAccountName, accept, context); + } + + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleMappingInner get(String resourceGroupName, String cloudAccountName) { + return getWithResponse(resourceGroupName, cloudAccountName, Context.NONE).getValue(); + } + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Role Mapping Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String cloudAccountName, RoleMappingInner resource) { + 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, cloudAccountName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Role Mapping Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudAccountName, + RoleMappingInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, cloudAccountName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Role Mapping Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + RoleMappingInner resource, 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, cloudAccountName, contentType, accept, resource, + context); + } + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Role Mapping Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleMappingInner createOrUpdate(String resourceGroupName, String cloudAccountName, + RoleMappingInner resource) { + return createOrUpdateWithResponse(resourceGroupName, cloudAccountName, resource, Context.NONE).getValue(); + } + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String cloudAccountName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName) { + return deleteWithResponseAsync(resourceGroupName, cloudAccountName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String cloudAccountName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, context); + } + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName) { + deleteWithResponse(resourceGroupName, cloudAccountName, Context.NONE); + } + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, 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 RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String cloudAccountName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, cloudAccountName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String cloudAccountName) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String cloudAccountName, + Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String cloudAccountName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, cloudAccountName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String cloudAccountName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, cloudAccountName, 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 the response of a RoleMapping list operation 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 the response of a RoleMapping list operation 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 the response of a RoleMapping list operation 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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsImpl.java new file mode 100644 index 000000000000..1949dee097f9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.RoleMappingsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMapping; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappings; + +public final class RoleMappingsImpl implements RoleMappings { + private static final ClientLogger LOGGER = new ClientLogger(RoleMappingsImpl.class); + + private final RoleMappingsClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public RoleMappingsImpl(RoleMappingsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudAccountName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudAccountName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RoleMappingImpl(inner.getValue(), this.manager())); + } + + public RoleMapping get(String resourceGroupName, String cloudAccountName) { + RoleMappingInner inner = this.serviceClient().get(resourceGroupName, cloudAccountName); + if (inner != null) { + return new RoleMappingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + RoleMappingInner resource, Context context) { + Response inner + = this.serviceClient().createOrUpdateWithResponse(resourceGroupName, cloudAccountName, resource, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RoleMappingImpl(inner.getValue(), this.manager())); + } + + public RoleMapping createOrUpdate(String resourceGroupName, String cloudAccountName, RoleMappingInner resource) { + RoleMappingInner inner = this.serviceClient().createOrUpdate(resourceGroupName, cloudAccountName, resource); + if (inner != null) { + return new RoleMappingImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String cloudAccountName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, cloudAccountName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String cloudAccountName) { + this.serviceClient().delete(resourceGroupName, cloudAccountName); + } + + public PagedIterable list(String resourceGroupName, String cloudAccountName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, cloudAccountName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RoleMappingImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String cloudAccountName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, cloudAccountName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RoleMappingImpl(inner1, this.manager())); + } + + private RoleMappingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsClientImpl.java new file mode 100644 index 000000000000..00fecdb4e843 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsClientImpl.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.commvaultcontentstore.fluent.SaaSOperationGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; +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 SaaSOperationGroupsClient. + */ +public final class SaaSOperationGroupsClientImpl implements SaaSOperationGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SaaSOperationGroupsService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of SaaSOperationGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SaaSOperationGroupsClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service = RestProxy.create(SaaSOperationGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientSaaSOperationGroups to be used + * by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientSaaSOperationGroups") + public interface SaaSOperationGroupsService { + @Post("/subscriptions/{subscriptionId}/providers/Commvault.ContentStore/activateSaaS") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> activateResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ActivateSaaSParameterRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Commvault.ContentStore/activateSaaS") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response activateResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ActivateSaaSParameterRequest body, Context context); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> activateResourceWithResponseAsync(ActivateSaaSParameterRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.activateResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response activateResourceWithResponse(ActivateSaaSParameterRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.activateResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, Context.NONE); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response activateResourceWithResponse(ActivateSaaSParameterRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.activateResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SaaSResourceDetailsResponseInner> + beginActivateResourceAsync(ActivateSaaSParameterRequest body) { + Mono>> mono = activateResourceWithResponseAsync(body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SaaSResourceDetailsResponseInner.class, + SaaSResourceDetailsResponseInner.class, this.client.getContext()); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaaSResourceDetailsResponseInner> + beginActivateResource(ActivateSaaSParameterRequest body) { + Response response = activateResourceWithResponse(body); + return this.client.getLroResult(response, + SaaSResourceDetailsResponseInner.class, SaaSResourceDetailsResponseInner.class, Context.NONE); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SaaSResourceDetailsResponseInner> + beginActivateResource(ActivateSaaSParameterRequest body, Context context) { + Response response = activateResourceWithResponse(body, context); + return this.client.getLroResult(response, + SaaSResourceDetailsResponseInner.class, SaaSResourceDetailsResponseInner.class, context); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono activateResourceAsync(ActivateSaaSParameterRequest body) { + return beginActivateResourceAsync(body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaaSResourceDetailsResponseInner activateResource(ActivateSaaSParameterRequest body) { + return beginActivateResource(body).getFinalResult(); + } + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SaaSResourceDetailsResponseInner activateResource(ActivateSaaSParameterRequest body, Context context) { + return beginActivateResource(body, context).getFinalResult(); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsImpl.java new file mode 100644 index 000000000000..f64ad15e4455 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.commvaultcontentstore.fluent.SaaSOperationGroupsClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSOperationGroups; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSResourceDetailsResponse; + +public final class SaaSOperationGroupsImpl implements SaaSOperationGroups { + private static final ClientLogger LOGGER = new ClientLogger(SaaSOperationGroupsImpl.class); + + private final SaaSOperationGroupsClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public SaaSOperationGroupsImpl(SaaSOperationGroupsClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SaaSResourceDetailsResponse activateResource(ActivateSaaSParameterRequest body) { + SaaSResourceDetailsResponseInner inner = this.serviceClient().activateResource(body); + if (inner != null) { + return new SaaSResourceDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SaaSResourceDetailsResponse activateResource(ActivateSaaSParameterRequest body, Context context) { + SaaSResourceDetailsResponseInner inner = this.serviceClient().activateResource(body, context); + if (inner != null) { + return new SaaSResourceDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private SaaSOperationGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSResourceDetailsResponseImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSResourceDetailsResponseImpl.java new file mode 100644 index 000000000000..e767cd6d12e6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSResourceDetailsResponseImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSResourceDetailsResponse; + +public final class SaaSResourceDetailsResponseImpl implements SaaSResourceDetailsResponse { + private SaaSResourceDetailsResponseInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + SaaSResourceDetailsResponseImpl(SaaSResourceDetailsResponseInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String saaSResourceId() { + return this.innerModel().saaSResourceId(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SaaSResourceDetailsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StorageImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StorageImpl.java new file mode 100644 index 000000000000..cc4f74a9c88d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StorageImpl.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner; +import com.azure.resourcemanager.commvaultcontentstore.models.Storage; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; + +public final class StorageImpl implements Storage, Storage.Definition, Storage.Update { + private StorageInner innerObject; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public StorageProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public StorageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudAccountName; + + private String storageName; + + public StorageImpl withExistingCloudAccount(String resourceGroupName, String cloudAccountName) { + this.resourceGroupName = resourceGroupName; + this.cloudAccountName = cloudAccountName; + return this; + } + + public Storage create() { + this.innerObject = serviceManager.serviceClient() + .getStorages() + .createOrUpdate(resourceGroupName, cloudAccountName, storageName, this.innerModel(), Context.NONE); + return this; + } + + public Storage create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorages() + .createOrUpdate(resourceGroupName, cloudAccountName, storageName, this.innerModel(), context); + return this; + } + + StorageImpl(String name, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = new StorageInner(); + this.serviceManager = serviceManager; + this.storageName = name; + } + + public StorageImpl update() { + return this; + } + + public Storage apply() { + this.innerObject = serviceManager.serviceClient() + .getStorages() + .createOrUpdate(resourceGroupName, cloudAccountName, storageName, this.innerModel(), Context.NONE); + return this; + } + + public Storage apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorages() + .createOrUpdate(resourceGroupName, cloudAccountName, storageName, this.innerModel(), context); + return this; + } + + StorageImpl(StorageInner innerObject, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudAccountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cloudAccounts"); + this.storageName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "storages"); + } + + public Storage refresh() { + this.innerObject = serviceManager.serviceClient() + .getStorages() + .getWithResponse(resourceGroupName, cloudAccountName, storageName, Context.NONE) + .getValue(); + return this; + } + + public Storage refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorages() + .getWithResponse(resourceGroupName, cloudAccountName, storageName, context) + .getValue(); + return this; + } + + public StorageImpl withProperties(StorageProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesClientImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesClientImpl.java new file mode 100644 index 000000000000..ce93f2cec6a6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesClientImpl.java @@ -0,0 +1,769 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.commvaultcontentstore.fluent.StoragesClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.StorageListResult; +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 StoragesClient. + */ +public final class StoragesClientImpl implements StoragesClient { + /** + * The proxy service used to perform REST calls. + */ + private final StoragesService service; + + /** + * The service client containing this operation class. + */ + private final CommvaultContentStoreManagementClientImpl client; + + /** + * Initializes an instance of StoragesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StoragesClientImpl(CommvaultContentStoreManagementClientImpl client) { + this.service = RestProxy.create(StoragesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommvaultContentStoreManagementClientStorages to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommvaultContentStoreManagementClientStorages") + public interface StoragesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages/{storageName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("storageName") String storageName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages/{storageName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("storageName") String storageName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages/{storageName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("storageName") String storageName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages/{storageName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("storageName") String storageName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages/{storageName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("storageName") String storageName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages/{storageName}") + @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, + @PathParam("cloudAccountName") String cloudAccountName, @PathParam("storageName") String storageName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudAccount(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Commvault.ContentStore/cloudAccounts/{cloudAccountName}/storages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCloudAccountSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudAccountName") String cloudAccountName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudAccountNext( + @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 listByCloudAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String cloudAccountName, + String storageName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, storageName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudAccountName, String storageName) { + return getWithResponseAsync(resourceGroupName, cloudAccountName, storageName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String cloudAccountName, String storageName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, cloudAccountName, storageName, accept, context); + } + + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageInner get(String resourceGroupName, String cloudAccountName, String storageName) { + return getWithResponse(resourceGroupName, cloudAccountName, storageName, Context.NONE).getValue(); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String cloudAccountName, String storageName, StorageInner resource) { + 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, cloudAccountName, storageName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + String storageName, StorageInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, storageName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Storage Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + String storageName, StorageInner resource, 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, cloudAccountName, storageName, contentType, accept, + resource, context); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageInner> beginCreateOrUpdateAsync(String resourceGroupName, + String cloudAccountName, String storageName, StorageInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, cloudAccountName, storageName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageInner.class, StorageInner.class, this.client.getContext()); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, String storageName, StorageInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, cloudAccountName, storageName, resource); + return this.client.getLroResult(response, StorageInner.class, StorageInner.class, + Context.NONE); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageInner> beginCreateOrUpdate(String resourceGroupName, + String cloudAccountName, String storageName, StorageInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, cloudAccountName, storageName, resource, context); + return this.client.getLroResult(response, StorageInner.class, StorageInner.class, + context); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudAccountName, + String storageName, StorageInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudAccountName, storageName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageInner createOrUpdate(String resourceGroupName, String cloudAccountName, String storageName, + StorageInner resource) { + return beginCreateOrUpdate(resourceGroupName, cloudAccountName, storageName, resource).getFinalResult(); + } + + /** + * Create a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Storage Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageInner createOrUpdate(String resourceGroupName, String cloudAccountName, String storageName, + StorageInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, cloudAccountName, storageName, resource, context) + .getFinalResult(); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String cloudAccountName, + String storageName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, storageName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, + String storageName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, storageName, Context.NONE); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String cloudAccountName, + String storageName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, storageName, context); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 cloudAccountName, + String storageName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, cloudAccountName, storageName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 cloudAccountName, + String storageName) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName, storageName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudAccountName, + String storageName, Context context) { + Response response = deleteWithResponse(resourceGroupName, cloudAccountName, storageName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 cloudAccountName, String storageName) { + return beginDeleteAsync(resourceGroupName, cloudAccountName, storageName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 cloudAccountName, String storageName) { + beginDelete(resourceGroupName, cloudAccountName, storageName).getFinalResult(); + } + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudAccountName, String storageName, Context context) { + beginDelete(resourceGroupName, cloudAccountName, storageName, context).getFinalResult(); + } + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudAccountSinglePageAsync(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCloudAccount(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, 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 Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudAccountAsync(String resourceGroupName, String cloudAccountName) { + return new PagedFlux<>(() -> listByCloudAccountSinglePageAsync(resourceGroupName, cloudAccountName), + nextLink -> listByCloudAccountNextSinglePageAsync(nextLink)); + } + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountSinglePage(String resourceGroupName, + String cloudAccountName) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountSinglePage(String resourceGroupName, String cloudAccountName, + Context context) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, cloudAccountName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName) { + return new PagedIterable<>(() -> listByCloudAccountSinglePage(resourceGroupName, cloudAccountName), + nextLink -> listByCloudAccountNextSinglePage(nextLink)); + } + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context) { + return new PagedIterable<>(() -> listByCloudAccountSinglePage(resourceGroupName, cloudAccountName, context), + nextLink -> listByCloudAccountNextSinglePage(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 Storage list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudAccountNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudAccountNext(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 Storage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountNextSync(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 Storage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCloudAccountNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByCloudAccountNextSync(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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesImpl.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesImpl.java new file mode 100644 index 000000000000..5b2f2f83dd68 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.StoragesClient; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner; +import com.azure.resourcemanager.commvaultcontentstore.models.Storage; +import com.azure.resourcemanager.commvaultcontentstore.models.Storages; + +public final class StoragesImpl implements Storages { + private static final ClientLogger LOGGER = new ClientLogger(StoragesImpl.class); + + private final StoragesClient innerClient; + + private final com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager; + + public StoragesImpl(StoragesClient innerClient, + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudAccountName, String storageName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudAccountName, storageName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageImpl(inner.getValue(), this.manager())); + } + + public Storage get(String resourceGroupName, String cloudAccountName, String storageName) { + StorageInner inner = this.serviceClient().get(resourceGroupName, cloudAccountName, storageName); + if (inner != null) { + return new StorageImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String cloudAccountName, String storageName) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, storageName); + } + + public void delete(String resourceGroupName, String cloudAccountName, String storageName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudAccountName, storageName, context); + } + + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName) { + PagedIterable inner + = this.serviceClient().listByCloudAccount(resourceGroupName, cloudAccountName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageImpl(inner1, this.manager())); + } + + public PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context) { + PagedIterable inner + = this.serviceClient().listByCloudAccount(resourceGroupName, cloudAccountName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageImpl(inner1, this.manager())); + } + + public Storage 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String storageName = ResourceManagerUtils.getValueFromIdByName(id, "storages"); + if (storageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storages'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudAccountName, storageName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String storageName = ResourceManagerUtils.getValueFromIdByName(id, "storages"); + if (storageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storages'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudAccountName, storageName, 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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String storageName = ResourceManagerUtils.getValueFromIdByName(id, "storages"); + if (storageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storages'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, storageName, Context.NONE); + } + + public void deleteByIdWithResponse(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 cloudAccountName = ResourceManagerUtils.getValueFromIdByName(id, "cloudAccounts"); + if (cloudAccountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudAccounts'.", id))); + } + String storageName = ResourceManagerUtils.getValueFromIdByName(id, "storages"); + if (storageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storages'.", id))); + } + this.delete(resourceGroupName, cloudAccountName, storageName, context); + } + + private StoragesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager() { + return this.serviceManager; + } + + public StorageImpl define(String name) { + return new StorageImpl(name, this.manager()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CloudAccountListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CloudAccountListResult.java new file mode 100644 index 000000000000..72d4286df4ae --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CloudAccountListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.CloudAccountInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CloudAccount list operation. + */ +@Immutable +public final class CloudAccountListResult implements JsonSerializable { + /* + * The CloudAccount items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CloudAccountListResult class. + */ + private CloudAccountListResult() { + } + + /** + * Get the value property: The CloudAccount 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 CloudAccountListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudAccountListResult 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 CloudAccountListResult. + */ + public static CloudAccountListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudAccountListResult deserializedCloudAccountListResult = new CloudAccountListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CloudAccountInner.fromJson(reader1)); + deserializedCloudAccountListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCloudAccountListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudAccountListResult; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CommvaultPlanListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CommvaultPlanListResult.java new file mode 100644 index 000000000000..990ef7510e90 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CommvaultPlanListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.CommvaultPlanInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CommvaultPlan list operation. + */ +@Immutable +public final class CommvaultPlanListResult implements JsonSerializable { + /* + * The CommvaultPlan items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CommvaultPlanListResult class. + */ + private CommvaultPlanListResult() { + } + + /** + * Get the value property: The CommvaultPlan 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 CommvaultPlanListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommvaultPlanListResult 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 CommvaultPlanListResult. + */ + public static CommvaultPlanListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommvaultPlanListResult deserializedCommvaultPlanListResult = new CommvaultPlanListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CommvaultPlanInner.fromJson(reader1)); + deserializedCommvaultPlanListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCommvaultPlanListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommvaultPlanListResult; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/OperationListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..ad703da5b4f1 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectedItemListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectedItemListResult.java new file mode 100644 index 000000000000..a477264217e3 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectedItemListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.ProtectedItemInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ProtectedItem list operation. + */ +@Immutable +public final class ProtectedItemListResult implements JsonSerializable { + /* + * The ProtectedItem items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ProtectedItemListResult class. + */ + private ProtectedItemListResult() { + } + + /** + * Get the value property: The ProtectedItem 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 ProtectedItemListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectedItemListResult 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 ProtectedItemListResult. + */ + public static ProtectedItemListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectedItemListResult deserializedProtectedItemListResult = new ProtectedItemListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ProtectedItemInner.fromJson(reader1)); + deserializedProtectedItemListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProtectedItemListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectedItemListResult; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectionGroupListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectionGroupListResult.java new file mode 100644 index 000000000000..efbcff07be36 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectionGroupListResult.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.commvaultcontentstore.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.commvaultcontentstore.fluent.models.ProtectionGroupInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ProtectionGroup list operation. + */ +@Immutable +public final class ProtectionGroupListResult implements JsonSerializable { + /* + * The ProtectionGroup items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ProtectionGroupListResult class. + */ + private ProtectionGroupListResult() { + } + + /** + * Get the value property: The ProtectionGroup 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 ProtectionGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionGroupListResult 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 ProtectionGroupListResult. + */ + public static ProtectionGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionGroupListResult deserializedProtectionGroupListResult = new ProtectionGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProtectionGroupInner.fromJson(reader1)); + deserializedProtectionGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProtectionGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionGroupListResult; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/RoleMappingListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/RoleMappingListResult.java new file mode 100644 index 000000000000..1f8448a2e6ac --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/RoleMappingListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.RoleMappingInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a RoleMapping list operation. + */ +@Immutable +public final class RoleMappingListResult implements JsonSerializable { + /* + * The RoleMapping items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of RoleMappingListResult class. + */ + private RoleMappingListResult() { + } + + /** + * Get the value property: The RoleMapping 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 RoleMappingListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoleMappingListResult 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 RoleMappingListResult. + */ + public static RoleMappingListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RoleMappingListResult deserializedRoleMappingListResult = new RoleMappingListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RoleMappingInner.fromJson(reader1)); + deserializedRoleMappingListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRoleMappingListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRoleMappingListResult; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/StorageListResult.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/StorageListResult.java new file mode 100644 index 000000000000..571a1729c0ae --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/StorageListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.StorageInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Storage list operation. + */ +@Immutable +public final class StorageListResult implements JsonSerializable { + /* + * The Storage items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of StorageListResult class. + */ + private StorageListResult() { + } + + /** + * Get the value property: The Storage 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 StorageListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageListResult 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 StorageListResult. + */ + public static StorageListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageListResult deserializedStorageListResult = new StorageListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> StorageInner.fromJson(reader1)); + deserializedStorageListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStorageListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageListResult; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/package-info.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/package-info.java new file mode 100644 index 000000000000..af03e155dda7 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/package-info.java @@ -0,0 +1,8 @@ +// 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 CommvaultContentStore. + */ +package com.azure.resourcemanager.commvaultcontentstore.implementation; diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActionType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActionType.java new file mode 100644 index 000000000000..20fe5d60ba9a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActivateSaaSParameterRequest.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActivateSaaSParameterRequest.java new file mode 100644 index 000000000000..2e99f09e0132 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActivateSaaSParameterRequest.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * SaaS guid for Activate and Validate SaaS Resource. + */ +@Fluent +public final class ActivateSaaSParameterRequest implements JsonSerializable { + /* + * SaaS guid for Activate and Validate SaaS Resource + */ + private String saaSGuid; + + /** + * Creates an instance of ActivateSaaSParameterRequest class. + */ + public ActivateSaaSParameterRequest() { + } + + /** + * Get the saaSGuid property: SaaS guid for Activate and Validate SaaS Resource. + * + * @return the saaSGuid value. + */ + public String saaSGuid() { + return this.saaSGuid; + } + + /** + * Set the saaSGuid property: SaaS guid for Activate and Validate SaaS Resource. + * + * @param saaSGuid the saaSGuid value to set. + * @return the ActivateSaaSParameterRequest object itself. + */ + public ActivateSaaSParameterRequest withSaaSGuid(String saaSGuid) { + this.saaSGuid = saaSGuid; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("saaSGuid", this.saaSGuid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivateSaaSParameterRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivateSaaSParameterRequest 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 ActivateSaaSParameterRequest. + */ + public static ActivateSaaSParameterRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivateSaaSParameterRequest deserializedActivateSaaSParameterRequest = new ActivateSaaSParameterRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("saaSGuid".equals(fieldName)) { + deserializedActivateSaaSParameterRequest.saaSGuid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActivateSaaSParameterRequest; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackUpType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackUpType.java new file mode 100644 index 000000000000..e18435ec6c0b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackUpType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of backup. + */ +public final class BackUpType extends ExpandableStringEnum { + /** + * Incremental backup. + */ + public static final BackUpType INCREMENTAL = fromString("INCREMENTAL"); + + /** + * Full backup. + */ + public static final BackUpType FULL = fromString("FULL"); + + /** + * Both incremental and full backups. + */ + public static final BackUpType BOTH = fromString("BOTH"); + + /** + * Creates a new instance of BackUpType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackUpType() { + } + + /** + * Creates or finds a BackUpType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackUpType. + */ + public static BackUpType fromString(String name) { + return fromString(name, BackUpType.class); + } + + /** + * Gets known BackUpType values. + * + * @return known BackUpType values. + */ + public static Collection values() { + return values(BackUpType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupLevel.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupLevel.java new file mode 100644 index 000000000000..ebbb6bbbc7eb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupLevel.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The level of backup. + */ +public final class BackupLevel extends ExpandableStringEnum { + /** + * Full backup level. + */ + public static final BackupLevel FULL = fromString("FULL"); + + /** + * Incremental backup level. + */ + public static final BackupLevel INCREMENTAL = fromString("INCREMENTAL"); + + /** + * Differential backup level. + */ + public static final BackupLevel DIFFERENTIAL = fromString("DIFFERENTIAL"); + + /** + * Synthetic full backup level. + */ + public static final BackupLevel SYNTHETIC_FULL = fromString("SYNTHETIC_FULL"); + + /** + * Creates a new instance of BackupLevel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackupLevel() { + } + + /** + * Creates or finds a BackupLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupLevel. + */ + public static BackupLevel fromString(String name) { + return fromString(name, BackupLevel.class); + } + + /** + * Gets known BackupLevel values. + * + * @return known BackupLevel values. + */ + public static Collection values() { + return values(BackupLevel.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupOptions.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupOptions.java new file mode 100644 index 000000000000..0d9a2cb36332 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupOptions.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 backup options for the VM backup. + */ +@Fluent +public final class BackupOptions implements JsonSerializable { + /* + * Indicates whether to stop backup or not for the VM + */ + private BackupLevel backupLevel; + + /* + * The name of the backup job to be shown in Commvault + */ + private String jobDescription; + + /* + * Indicates whether to run backup immediately or not for the VM + */ + private boolean backupCopyImmediately; + + /* + * Indicates whether to run snapshot backup or not for the VM, if false, it will run regular backup + */ + private boolean runSnapShotBackup; + + /* + * Indicates whether to notify the user on job completion + */ + private boolean notifyUserOnJobCompletion; + + /** + * Creates an instance of BackupOptions class. + */ + public BackupOptions() { + } + + /** + * Get the backupLevel property: Indicates whether to stop backup or not for the VM. + * + * @return the backupLevel value. + */ + public BackupLevel backupLevel() { + return this.backupLevel; + } + + /** + * Set the backupLevel property: Indicates whether to stop backup or not for the VM. + * + * @param backupLevel the backupLevel value to set. + * @return the BackupOptions object itself. + */ + public BackupOptions withBackupLevel(BackupLevel backupLevel) { + this.backupLevel = backupLevel; + return this; + } + + /** + * Get the jobDescription property: The name of the backup job to be shown in Commvault. + * + * @return the jobDescription value. + */ + public String jobDescription() { + return this.jobDescription; + } + + /** + * Set the jobDescription property: The name of the backup job to be shown in Commvault. + * + * @param jobDescription the jobDescription value to set. + * @return the BackupOptions object itself. + */ + public BackupOptions withJobDescription(String jobDescription) { + this.jobDescription = jobDescription; + return this; + } + + /** + * Get the backupCopyImmediately property: Indicates whether to run backup immediately or not for the VM. + * + * @return the backupCopyImmediately value. + */ + public boolean backupCopyImmediately() { + return this.backupCopyImmediately; + } + + /** + * Set the backupCopyImmediately property: Indicates whether to run backup immediately or not for the VM. + * + * @param backupCopyImmediately the backupCopyImmediately value to set. + * @return the BackupOptions object itself. + */ + public BackupOptions withBackupCopyImmediately(boolean backupCopyImmediately) { + this.backupCopyImmediately = backupCopyImmediately; + return this; + } + + /** + * Get the runSnapShotBackup property: Indicates whether to run snapshot backup or not for the VM, if false, it will + * run regular backup. + * + * @return the runSnapShotBackup value. + */ + public boolean runSnapShotBackup() { + return this.runSnapShotBackup; + } + + /** + * Set the runSnapShotBackup property: Indicates whether to run snapshot backup or not for the VM, if false, it will + * run regular backup. + * + * @param runSnapShotBackup the runSnapShotBackup value to set. + * @return the BackupOptions object itself. + */ + public BackupOptions withRunSnapShotBackup(boolean runSnapShotBackup) { + this.runSnapShotBackup = runSnapShotBackup; + return this; + } + + /** + * Get the notifyUserOnJobCompletion property: Indicates whether to notify the user on job completion. + * + * @return the notifyUserOnJobCompletion value. + */ + public boolean notifyUserOnJobCompletion() { + return this.notifyUserOnJobCompletion; + } + + /** + * Set the notifyUserOnJobCompletion property: Indicates whether to notify the user on job completion. + * + * @param notifyUserOnJobCompletion the notifyUserOnJobCompletion value to set. + * @return the BackupOptions object itself. + */ + public BackupOptions withNotifyUserOnJobCompletion(boolean notifyUserOnJobCompletion) { + this.notifyUserOnJobCompletion = notifyUserOnJobCompletion; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("jobDescription", this.jobDescription); + jsonWriter.writeBooleanField("backupCopyImmediately", this.backupCopyImmediately); + jsonWriter.writeBooleanField("runSnapShotBackup", this.runSnapShotBackup); + jsonWriter.writeBooleanField("notifyUserOnJobCompletion", this.notifyUserOnJobCompletion); + jsonWriter.writeStringField("backupLevel", this.backupLevel == null ? null : this.backupLevel.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupOptions 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 BackupOptions. + */ + public static BackupOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupOptions deserializedBackupOptions = new BackupOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobDescription".equals(fieldName)) { + deserializedBackupOptions.jobDescription = reader.getString(); + } else if ("backupCopyImmediately".equals(fieldName)) { + deserializedBackupOptions.backupCopyImmediately = reader.getBoolean(); + } else if ("runSnapShotBackup".equals(fieldName)) { + deserializedBackupOptions.runSnapShotBackup = reader.getBoolean(); + } else if ("notifyUserOnJobCompletion".equals(fieldName)) { + deserializedBackupOptions.notifyUserOnJobCompletion = reader.getBoolean(); + } else if ("backupLevel".equals(fieldName)) { + deserializedBackupOptions.backupLevel = BackupLevel.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupOptions; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupRequest.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupRequest.java new file mode 100644 index 000000000000..308b2e91671e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupRequest.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 BackupProtectionGroupRequest. + */ +@Fluent +public final class BackupProtectionGroupRequest implements JsonSerializable { + /* + * The vm list details. + */ + private List vmList; + + /* + * The backup options for the VM backup + */ + private BackupOptions backupOptions; + + /** + * Creates an instance of BackupProtectionGroupRequest class. + */ + public BackupProtectionGroupRequest() { + } + + /** + * Get the vmList property: The vm list details. + * + * @return the vmList value. + */ + public List vmList() { + return this.vmList; + } + + /** + * Set the vmList property: The vm list details. + * + * @param vmList the vmList value to set. + * @return the BackupProtectionGroupRequest object itself. + */ + public BackupProtectionGroupRequest withVmList(List vmList) { + this.vmList = vmList; + return this; + } + + /** + * Get the backupOptions property: The backup options for the VM backup. + * + * @return the backupOptions value. + */ + public BackupOptions backupOptions() { + return this.backupOptions; + } + + /** + * Set the backupOptions property: The backup options for the VM backup. + * + * @param backupOptions the backupOptions value to set. + * @return the BackupProtectionGroupRequest object itself. + */ + public BackupProtectionGroupRequest withBackupOptions(BackupOptions backupOptions) { + this.backupOptions = backupOptions; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("vmList", this.vmList, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("backupOptions", this.backupOptions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupProtectionGroupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupProtectionGroupRequest 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 BackupProtectionGroupRequest. + */ + public static BackupProtectionGroupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupProtectionGroupRequest deserializedBackupProtectionGroupRequest = new BackupProtectionGroupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmList".equals(fieldName)) { + List vmList = reader.readArray(reader1 -> VmListItem.fromJson(reader1)); + deserializedBackupProtectionGroupRequest.vmList = vmList; + } else if ("backupOptions".equals(fieldName)) { + deserializedBackupProtectionGroupRequest.backupOptions = BackupOptions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupProtectionGroupRequest; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupResponse.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupResponse.java new file mode 100644 index 000000000000..18040fa073e5 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupResponse.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.commvaultcontentstore.models; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of BackupProtectionGroupResponse. + */ +public interface BackupProtectionGroupResponse { + /** + * Gets the taskId property: The Commvault response for taskId. + * + * @return the taskId value. + */ + int taskId(); + + /** + * Gets the jobIds property: The jobIds returned from Commvault. + * + * @return the jobIds value. + */ + List jobIds(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner + * object. + * + * @return the inner object. + */ + BackupProtectionGroupResponseInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupRuleType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupRuleType.java new file mode 100644 index 000000000000..5e64570d4167 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupRuleType.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of backup rule. + */ +public final class BackupRuleType extends ExpandableStringEnum { + /** + * All Jobs. + */ + public static final BackupRuleType ALL_JOBS = fromString("ALL_JOBS"); + + /** + * All Fulls. + */ + public static final BackupRuleType ALL_FULLS = fromString("ALL_FULLS"); + + /** + * Hourly Fulls. + */ + public static final BackupRuleType HOURLY_FULLS = fromString("HOURLY_FULLS"); + + /** + * Daily Fulls. + */ + public static final BackupRuleType DAILY_FULLS = fromString("DAILY_FULLS"); + + /** + * Weekly Fulls. + */ + public static final BackupRuleType WEEKLY_FULLS = fromString("WEEKLY_FULLS"); + + /** + * Monthly Fulls. + */ + public static final BackupRuleType MONTHLY_FULLS = fromString("MONTHLY_FULLS"); + + /** + * Yearly Fulls. + */ + public static final BackupRuleType YEARLY_FULLS = fromString("YEARLY_FULLS"); + + /** + * Quarterly Fulls. + */ + public static final BackupRuleType QUARTERLY_FULLS = fromString("QUARTERLY_FULLS"); + + /** + * Half Yearly Fulls. + */ + public static final BackupRuleType HALF_YEARLY_FULLS = fromString("HALF_YEARLY_FULLS"); + + /** + * Creates a new instance of BackupRuleType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackupRuleType() { + } + + /** + * Creates or finds a BackupRuleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupRuleType. + */ + public static BackupRuleType fromString(String name) { + return fromString(name, BackupRuleType.class); + } + + /** + * Gets known BackupRuleType values. + * + * @return known BackupRuleType values. + */ + public static Collection values() { + return values(BackupRuleType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccount.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccount.java new file mode 100644 index 000000000000..8e8b838d07a7 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccount.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CloudAccountInner; +import java.util.Map; + +/** + * An immutable client-side representation of CloudAccount. + */ +public interface CloudAccount { + /** + * 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. + */ + CloudAccountProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * 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.commvaultcontentstore.fluent.models.CloudAccountInner object. + * + * @return the inner object. + */ + CloudAccountInner innerModel(); + + /** + * The entirety of the CloudAccount definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CloudAccount definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CloudAccount definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CloudAccount 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 CloudAccount 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 CloudAccount 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.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + CloudAccount create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CloudAccount create(Context context); + } + + /** + * The stage of the CloudAccount 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 CloudAccount 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(CloudAccountProperties properties); + } + + /** + * The stage of the CloudAccount definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the CloudAccount resource. + * + * @return the stage of resource update. + */ + CloudAccount.Update update(); + + /** + * The template for CloudAccount update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CloudAccount apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CloudAccount apply(Context context); + } + + /** + * The CloudAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the CloudAccount 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 CloudAccount update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the CloudAccount update 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. + */ + Update withProperties(CloudAccountUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CloudAccount refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CloudAccount refresh(Context context); + + /** + * Links a new SaaS to the cloud account. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + CloudAccount linkSaaS(SaaSData body); + + /** + * Links a new SaaS to the cloud account. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + CloudAccount linkSaaS(SaaSData body, Context context); + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get latest linked SaaS resource operation along with {@link Response}. + */ + Response latestLinkedSaaSWithResponse(Context context); + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get latest linked SaaS resource operation. + */ + LatestLinkedSaaSResponse latestLinkedSaaS(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountProperties.java new file mode 100644 index 000000000000..c74aaa97f032 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountProperties.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * Properties specific to Commvault Cloud Account resource. + */ +@Fluent +public final class CloudAccountProperties implements JsonSerializable { + /* + * Marketplace details of the resource. + */ + private MarketplaceDetails marketplace; + + /* + * Details of the user. + */ + private UserDetails user; + + /* + * Provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /* + * SSO URL for the Commvault Cloud Account + */ + private String ssoUrl; + + /* + * The backup administrator principal provided during CCA create. Required on create (enforced by backend), ignored + * on update. + */ + private EntityInfo backupAdminOnCcaCreate; + + /* + * The multi-person authorization (MPA) administrator principal provided during CCA create. Required on create + * (enforced by backend), ignored on update. + */ + private EntityInfo multiPersonAuthorizationOnCcaCreate; + + /** + * Creates an instance of CloudAccountProperties class. + */ + public CloudAccountProperties() { + } + + /** + * Get the marketplace property: Marketplace details of the resource. + * + * @return the marketplace value. + */ + public MarketplaceDetails marketplace() { + return this.marketplace; + } + + /** + * Set the marketplace property: Marketplace details of the resource. + * + * @param marketplace the marketplace value to set. + * @return the CloudAccountProperties object itself. + */ + public CloudAccountProperties withMarketplace(MarketplaceDetails marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get the user property: Details of the user. + * + * @return the user value. + */ + public UserDetails user() { + return this.user; + } + + /** + * Set the user property: Details of the user. + * + * @param user the user value to set. + * @return the CloudAccountProperties object itself. + */ + public CloudAccountProperties withUser(UserDetails user) { + this.user = user; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the ssoUrl property: SSO URL for the Commvault Cloud Account. + * + * @return the ssoUrl value. + */ + public String ssoUrl() { + return this.ssoUrl; + } + + /** + * Get the backupAdminOnCcaCreate property: The backup administrator principal provided during CCA create. Required + * on create (enforced by backend), ignored on update. + * + * @return the backupAdminOnCcaCreate value. + */ + public EntityInfo backupAdminOnCcaCreate() { + return this.backupAdminOnCcaCreate; + } + + /** + * Set the backupAdminOnCcaCreate property: The backup administrator principal provided during CCA create. Required + * on create (enforced by backend), ignored on update. + * + * @param backupAdminOnCcaCreate the backupAdminOnCcaCreate value to set. + * @return the CloudAccountProperties object itself. + */ + public CloudAccountProperties withBackupAdminOnCcaCreate(EntityInfo backupAdminOnCcaCreate) { + this.backupAdminOnCcaCreate = backupAdminOnCcaCreate; + return this; + } + + /** + * Get the multiPersonAuthorizationOnCcaCreate property: The multi-person authorization (MPA) administrator + * principal provided during CCA create. Required on create (enforced by backend), ignored on update. + * + * @return the multiPersonAuthorizationOnCcaCreate value. + */ + public EntityInfo multiPersonAuthorizationOnCcaCreate() { + return this.multiPersonAuthorizationOnCcaCreate; + } + + /** + * Set the multiPersonAuthorizationOnCcaCreate property: The multi-person authorization (MPA) administrator + * principal provided during CCA create. Required on create (enforced by backend), ignored on update. + * + * @param multiPersonAuthorizationOnCcaCreate the multiPersonAuthorizationOnCcaCreate value to set. + * @return the CloudAccountProperties object itself. + */ + public CloudAccountProperties + withMultiPersonAuthorizationOnCcaCreate(EntityInfo multiPersonAuthorizationOnCcaCreate) { + this.multiPersonAuthorizationOnCcaCreate = multiPersonAuthorizationOnCcaCreate; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("marketplace", this.marketplace); + jsonWriter.writeJsonField("user", this.user); + jsonWriter.writeJsonField("backupAdminOnCcaCreate", this.backupAdminOnCcaCreate); + jsonWriter.writeJsonField("multiPersonAuthorizationOnCcaCreate", this.multiPersonAuthorizationOnCcaCreate); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudAccountProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudAccountProperties 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 CloudAccountProperties. + */ + public static CloudAccountProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudAccountProperties deserializedCloudAccountProperties = new CloudAccountProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("marketplace".equals(fieldName)) { + deserializedCloudAccountProperties.marketplace = MarketplaceDetails.fromJson(reader); + } else if ("user".equals(fieldName)) { + deserializedCloudAccountProperties.user = UserDetails.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedCloudAccountProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("ssoUrl".equals(fieldName)) { + deserializedCloudAccountProperties.ssoUrl = reader.getString(); + } else if ("backupAdminOnCcaCreate".equals(fieldName)) { + deserializedCloudAccountProperties.backupAdminOnCcaCreate = EntityInfo.fromJson(reader); + } else if ("multiPersonAuthorizationOnCcaCreate".equals(fieldName)) { + deserializedCloudAccountProperties.multiPersonAuthorizationOnCcaCreate + = EntityInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudAccountProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdate.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdate.java new file mode 100644 index 000000000000..7a7cffbc9c5f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdate.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * The type used for update operations of the CloudAccount. + */ +@Fluent +public final class CloudAccountUpdate implements JsonSerializable { + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private CloudAccountUpdateProperties properties; + + /** + * Creates an instance of CloudAccountUpdate class. + */ + public CloudAccountUpdate() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the CloudAccountUpdate object itself. + */ + public CloudAccountUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * 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 CloudAccountUpdate object itself. + */ + public CloudAccountUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public CloudAccountUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CloudAccountUpdate object itself. + */ + public CloudAccountUpdate withProperties(CloudAccountUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudAccountUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudAccountUpdate 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 CloudAccountUpdate. + */ + public static CloudAccountUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudAccountUpdate deserializedCloudAccountUpdate = new CloudAccountUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedCloudAccountUpdate.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCloudAccountUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedCloudAccountUpdate.properties = CloudAccountUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudAccountUpdate; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdateProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdateProperties.java new file mode 100644 index 000000000000..313234e7d3e3 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdateProperties.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 updatable properties of the CloudAccount. + */ +@Fluent +public final class CloudAccountUpdateProperties implements JsonSerializable { + /* + * Marketplace details of the resource. + */ + private MarketplaceDetails marketplace; + + /* + * Details of the user. + */ + private UserDetails user; + + /** + * Creates an instance of CloudAccountUpdateProperties class. + */ + public CloudAccountUpdateProperties() { + } + + /** + * Get the marketplace property: Marketplace details of the resource. + * + * @return the marketplace value. + */ + public MarketplaceDetails marketplace() { + return this.marketplace; + } + + /** + * Set the marketplace property: Marketplace details of the resource. + * + * @param marketplace the marketplace value to set. + * @return the CloudAccountUpdateProperties object itself. + */ + public CloudAccountUpdateProperties withMarketplace(MarketplaceDetails marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get the user property: Details of the user. + * + * @return the user value. + */ + public UserDetails user() { + return this.user; + } + + /** + * Set the user property: Details of the user. + * + * @param user the user value to set. + * @return the CloudAccountUpdateProperties object itself. + */ + public CloudAccountUpdateProperties withUser(UserDetails user) { + this.user = user; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("marketplace", this.marketplace); + jsonWriter.writeJsonField("user", this.user); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudAccountUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudAccountUpdateProperties 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 CloudAccountUpdateProperties. + */ + public static CloudAccountUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudAccountUpdateProperties deserializedCloudAccountUpdateProperties = new CloudAccountUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("marketplace".equals(fieldName)) { + deserializedCloudAccountUpdateProperties.marketplace = MarketplaceDetails.fromJson(reader); + } else if ("user".equals(fieldName)) { + deserializedCloudAccountUpdateProperties.user = UserDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudAccountUpdateProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccounts.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccounts.java new file mode 100644 index 000000000000..ebd6ac445ba5 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccounts.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 CloudAccounts. + */ +public interface CloudAccounts { + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String cloudAccountName, + Context context); + + /** + * Get a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CloudAccount. + */ + CloudAccount getByResourceGroup(String resourceGroupName, String cloudAccountName); + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName); + + /** + * Delete a CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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. + */ + void delete(String resourceGroupName, String cloudAccountName, Context context); + + /** + * List CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CloudAccount resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List CloudAccount resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List CloudAccount resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CloudAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + CloudAccount linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body); + + /** + * Links a new SaaS to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + CloudAccount linkSaaS(String resourceGroupName, String cloudAccountName, SaaSData body, Context context); + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation along with {@link Response}. + */ + Response latestLinkedSaaSWithResponse(String resourceGroupName, String cloudAccountName, + Context context); + + /** + * Returns the latest SaaS linked to the cloud account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 response of get latest linked SaaS resource operation. + */ + LatestLinkedSaaSResponse latestLinkedSaaS(String resourceGroupName, String cloudAccountName); + + /** + * Get a CloudAccount. + * + * @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 CloudAccount along with {@link Response}. + */ + CloudAccount getById(String id); + + /** + * Get a CloudAccount. + * + * @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 CloudAccount along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CloudAccount. + * + * @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 CloudAccount. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CloudAccount resource. + * + * @param name resource name. + * @return the first stage of the new CloudAccount definition. + */ + CloudAccount.DefinitionStages.Blank define(String name); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CommvaultPlan.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CommvaultPlan.java new file mode 100644 index 000000000000..8b25865920a2 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CommvaultPlan.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner; + +/** + * An immutable client-side representation of CommvaultPlan. + */ +public interface CommvaultPlan { + /** + * 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. + */ + PlanProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner object. + * + * @return the inner object. + */ + CommvaultPlanInner innerModel(); + + /** + * The entirety of the CommvaultPlan definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The CommvaultPlan definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CommvaultPlan definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the CommvaultPlan definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, cloudAccountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @return the next definition stage. + */ + WithCreate withExistingCloudAccount(String resourceGroupName, String cloudAccountName); + } + + /** + * The stage of the CommvaultPlan 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + CommvaultPlan create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CommvaultPlan create(Context context); + } + + /** + * The stage of the CommvaultPlan 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(PlanProperties properties); + } + } + + /** + * Begins update for the CommvaultPlan resource. + * + * @return the stage of resource update. + */ + CommvaultPlan.Update update(); + + /** + * The template for CommvaultPlan update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CommvaultPlan apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CommvaultPlan apply(Context context); + } + + /** + * The CommvaultPlan update stages. + */ + interface UpdateStages { + /** + * The stage of the CommvaultPlan update 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. + */ + Update withProperties(PlanProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CommvaultPlan refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CommvaultPlan refresh(Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsRequest.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsRequest.java new file mode 100644 index 000000000000..572492c97096 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsRequest.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.commvaultcontentstore.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; + +/** + * Request to count protected items for the provided CCA resource IDs across subscriptions. + */ +@Fluent +public final class CountProtectedItemsRequest implements JsonSerializable { + /* + * The list of CCA resource IDs. + */ + private List resourceIds; + + /** + * Creates an instance of CountProtectedItemsRequest class. + */ + public CountProtectedItemsRequest() { + } + + /** + * Get the resourceIds property: The list of CCA resource IDs. + * + * @return the resourceIds value. + */ + public List resourceIds() { + return this.resourceIds; + } + + /** + * Set the resourceIds property: The list of CCA resource IDs. + * + * @param resourceIds the resourceIds value to set. + * @return the CountProtectedItemsRequest object itself. + */ + public CountProtectedItemsRequest withResourceIds(List resourceIds) { + this.resourceIds = resourceIds; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceIds", this.resourceIds, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CountProtectedItemsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CountProtectedItemsRequest 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 CountProtectedItemsRequest. + */ + public static CountProtectedItemsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CountProtectedItemsRequest deserializedCountProtectedItemsRequest = new CountProtectedItemsRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceIds".equals(fieldName)) { + List resourceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedCountProtectedItemsRequest.resourceIds = resourceIds; + } else { + reader.skipChildren(); + } + } + + return deserializedCountProtectedItemsRequest; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsResponse.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsResponse.java new file mode 100644 index 000000000000..1752b0db8d95 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsResponse.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.commvaultcontentstore.models; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner; + +/** + * An immutable client-side representation of CountProtectedItemsResponse. + */ +public interface CountProtectedItemsResponse { + /** + * Gets the count property: The count of protected items. + * + * @return the count value. + */ + String count(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner + * object. + * + * @return the inner object. + */ + CountProtectedItemsResponseInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/DayOfWeek.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/DayOfWeek.java new file mode 100644 index 000000000000..f60d008f51c9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/DayOfWeek.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Day of Week Enum. + */ +public final class DayOfWeek extends ExpandableStringEnum { + /** + * First Day of the Week. + */ + public static final DayOfWeek SUNDAY = fromString("SUNDAY"); + + /** + * Second Day of the Week. + */ + public static final DayOfWeek MONDAY = fromString("MONDAY"); + + /** + * Third Day of the Week. + */ + public static final DayOfWeek TUESDAY = fromString("TUESDAY"); + + /** + * Fourth Day of the Week. + */ + public static final DayOfWeek WEDNESDAY = fromString("WEDNESDAY"); + + /** + * Fifth Day of the Week. + */ + public static final DayOfWeek THURSDAY = fromString("THURSDAY"); + + /** + * Sixth Day of the Week. + */ + public static final DayOfWeek FRIDAY = fromString("FRIDAY"); + + /** + * Seventh Day of the Week. + */ + public static final DayOfWeek SATURDAY = fromString("SATURDAY"); + + /** + * Any Day of the week. + */ + public static final DayOfWeek DAY = fromString("DAY"); + + /** + * Weekday Identifier. + */ + public static final DayOfWeek WEEKDAY = fromString("WEEKDAY"); + + /** + * Weekend Identifier. + */ + public static final DayOfWeek WEEKEND_DAYS = fromString("WEEKEND_DAYS"); + + /** + * Creates a new instance of DayOfWeek value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DayOfWeek() { + } + + /** + * Creates or finds a DayOfWeek from its string representation. + * + * @param name a name to look for. + * @return the corresponding DayOfWeek. + */ + public static DayOfWeek fromString(String name) { + return fromString(name, DayOfWeek.class); + } + + /** + * Gets known DayOfWeek values. + * + * @return known DayOfWeek values. + */ + public static Collection values() { + return values(DayOfWeek.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityInfo.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityInfo.java new file mode 100644 index 000000000000..e2dfdc133237 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityInfo.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * Information about an Entra entity (user or group) assigned to a role. + */ +@Fluent +public final class EntityInfo implements JsonSerializable { + /* + * The unique identifier (UUID) of the Entra entity + */ + private String id; + + /* + * The display name of the Entra entity + */ + private String displayName; + + /* + * The type of entity - user or group + */ + private EntityType entityType; + + /** + * Creates an instance of EntityInfo class. + */ + public EntityInfo() { + } + + /** + * Get the id property: The unique identifier (UUID) of the Entra entity. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The unique identifier (UUID) of the Entra entity. + * + * @param id the id value to set. + * @return the EntityInfo object itself. + */ + public EntityInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName property: The display name of the Entra entity. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the Entra entity. + * + * @param displayName the displayName value to set. + * @return the EntityInfo object itself. + */ + public EntityInfo withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the entityType property: The type of entity - user or group. + * + * @return the entityType value. + */ + public EntityType entityType() { + return this.entityType; + } + + /** + * Set the entityType property: The type of entity - user or group. + * + * @param entityType the entityType value to set. + * @return the EntityInfo object itself. + */ + public EntityInfo withEntityType(EntityType entityType) { + this.entityType = entityType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("entityType", this.entityType == null ? null : this.entityType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityInfo 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 EntityInfo. + */ + public static EntityInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityInfo deserializedEntityInfo = new EntityInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEntityInfo.id = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedEntityInfo.displayName = reader.getString(); + } else if ("entityType".equals(fieldName)) { + deserializedEntityInfo.entityType = EntityType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityInfo; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityType.java new file mode 100644 index 000000000000..7eccec50c2c1 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the entity. + */ +public final class EntityType extends ExpandableStringEnum { + /** + * The entity is an Entra user. + */ + public static final EntityType USER = fromString("User"); + + /** + * The entity is an Entra security group. + */ + public static final EntityType GROUP = fromString("Group"); + + /** + * Creates a new instance of EntityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityType() { + } + + /** + * Creates or finds a EntityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityType. + */ + public static EntityType fromString(String name) { + return fromString(name, EntityType.class); + } + + /** + * Gets known EntityType values. + * + * @return known EntityType values. + */ + public static Collection values() { + return values(EntityType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ExtendedRetentionTime.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ExtendedRetentionTime.java new file mode 100644 index 000000000000..90389b6154fb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ExtendedRetentionTime.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * Extended Retention Time. + */ +@Fluent +public final class ExtendedRetentionTime implements JsonSerializable { + /* + * Retention time for Extended Retention + */ + private RetentionTime retentionTime; + + /* + * Retention period for Extended Retention + */ + private Integer retentionPeriod; + + /* + * Backup Rule Type for Extended Retention + */ + private BackupRuleType backupRuleType; + + /** + * Creates an instance of ExtendedRetentionTime class. + */ + public ExtendedRetentionTime() { + } + + /** + * Get the retentionTime property: Retention time for Extended Retention. + * + * @return the retentionTime value. + */ + public RetentionTime retentionTime() { + return this.retentionTime; + } + + /** + * Set the retentionTime property: Retention time for Extended Retention. + * + * @param retentionTime the retentionTime value to set. + * @return the ExtendedRetentionTime object itself. + */ + public ExtendedRetentionTime withRetentionTime(RetentionTime retentionTime) { + this.retentionTime = retentionTime; + return this; + } + + /** + * Get the retentionPeriod property: Retention period for Extended Retention. + * + * @return the retentionPeriod value. + */ + public Integer retentionPeriod() { + return this.retentionPeriod; + } + + /** + * Set the retentionPeriod property: Retention period for Extended Retention. + * + * @param retentionPeriod the retentionPeriod value to set. + * @return the ExtendedRetentionTime object itself. + */ + public ExtendedRetentionTime withRetentionPeriod(Integer retentionPeriod) { + this.retentionPeriod = retentionPeriod; + return this; + } + + /** + * Get the backupRuleType property: Backup Rule Type for Extended Retention. + * + * @return the backupRuleType value. + */ + public BackupRuleType backupRuleType() { + return this.backupRuleType; + } + + /** + * Set the backupRuleType property: Backup Rule Type for Extended Retention. + * + * @param backupRuleType the backupRuleType value to set. + * @return the ExtendedRetentionTime object itself. + */ + public ExtendedRetentionTime withBackupRuleType(BackupRuleType backupRuleType) { + this.backupRuleType = backupRuleType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionTime", this.retentionTime == null ? null : this.retentionTime.toString()); + jsonWriter.writeNumberField("retentionPeriod", this.retentionPeriod); + jsonWriter.writeStringField("backupRuleType", + this.backupRuleType == null ? null : this.backupRuleType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendedRetentionTime from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendedRetentionTime 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 ExtendedRetentionTime. + */ + public static ExtendedRetentionTime fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtendedRetentionTime deserializedExtendedRetentionTime = new ExtendedRetentionTime(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionTime".equals(fieldName)) { + deserializedExtendedRetentionTime.retentionTime = RetentionTime.fromString(reader.getString()); + } else if ("retentionPeriod".equals(fieldName)) { + deserializedExtendedRetentionTime.retentionPeriod = reader.getNullable(JsonReader::getInt); + } else if ("backupRuleType".equals(fieldName)) { + deserializedExtendedRetentionTime.backupRuleType = BackupRuleType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExtendedRetentionTime; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Frequency.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Frequency.java new file mode 100644 index 000000000000..9f61b61a03b2 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Frequency.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The frequency of backups. + */ +public final class Frequency extends ExpandableStringEnum { + /** + * Daily backups. + */ + public static final Frequency DAILY = fromString("daily"); + + /** + * Weekly backups. + */ + public static final Frequency WEEKLY = fromString("weekly"); + + /** + * Monthly backups. + */ + public static final Frequency MONTHLY = fromString("monthly"); + + /** + * Yearly backups. + */ + public static final Frequency YEARLY = fromString("yearly"); + + /** + * Minutes backups. + */ + public static final Frequency MINUTES = fromString("minutes"); + + /** + * Creates a new instance of Frequency value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Frequency() { + } + + /** + * Creates or finds a Frequency from its string representation. + * + * @param name a name to look for. + * @return the corresponding Frequency. + */ + public static Frequency fromString(String name) { + return fromString(name, Frequency.class); + } + + /** + * Gets known Frequency values. + * + * @return known Frequency values. + */ + public static Collection values() { + return values(Frequency.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/LatestLinkedSaaSResponse.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/LatestLinkedSaaSResponse.java new file mode 100644 index 000000000000..b25319a4ba8c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/LatestLinkedSaaSResponse.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.commvaultcontentstore.models; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner; + +/** + * An immutable client-side representation of LatestLinkedSaaSResponse. + */ +public interface LatestLinkedSaaSResponse { + /** + * Gets the saaSResourceId property: SaaS resource id. + * + * @return the saaSResourceId value. + */ + String saaSResourceId(); + + /** + * Gets the isHiddenSaaS property: Flag indicating if the SaaS resource is hidden. + * + * @return the isHiddenSaaS value. + */ + Boolean isHiddenSaaS(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner + * object. + * + * @return the inner object. + */ + LatestLinkedSaaSResponseInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentity.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..daaa77c07723 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentity.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity 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 ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentityType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..790aa06b345e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentityType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceDetails.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceDetails.java new file mode 100644 index 000000000000..0dc42f943b59 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceDetails.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * Marketplace details for an organization. + */ +@Fluent +public final class MarketplaceDetails implements JsonSerializable { + /* + * Azure subscription id for the the marketplace offer is purchased from + */ + private String subscriptionId; + + /* + * Marketplace subscription status + */ + private MarketplaceSubscriptionStatus subscriptionStatus; + + /* + * Marketplace SaaS Resource Id + */ + private String saasResourceId; + + /* + * Offer details for the marketplace that is selected by the user + */ + private OfferDetails offerDetails; + + /** + * Creates an instance of MarketplaceDetails class. + */ + public MarketplaceDetails() { + } + + /** + * Get the subscriptionId property: Azure subscription id for the the marketplace offer is purchased from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Azure subscription id for the the marketplace offer is purchased from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the MarketplaceDetails object itself. + */ + public MarketplaceDetails withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the subscriptionStatus property: Marketplace subscription status. + * + * @return the subscriptionStatus value. + */ + public MarketplaceSubscriptionStatus subscriptionStatus() { + return this.subscriptionStatus; + } + + /** + * Get the saasResourceId property: Marketplace SaaS Resource Id. + * + * @return the saasResourceId value. + */ + public String saasResourceId() { + return this.saasResourceId; + } + + /** + * Set the saasResourceId property: Marketplace SaaS Resource Id. + * + * @param saasResourceId the saasResourceId value to set. + * @return the MarketplaceDetails object itself. + */ + public MarketplaceDetails withSaasResourceId(String saasResourceId) { + this.saasResourceId = saasResourceId; + return this; + } + + /** + * Get the offerDetails property: Offer details for the marketplace that is selected by the user. + * + * @return the offerDetails value. + */ + public OfferDetails offerDetails() { + return this.offerDetails; + } + + /** + * Set the offerDetails property: Offer details for the marketplace that is selected by the user. + * + * @param offerDetails the offerDetails value to set. + * @return the MarketplaceDetails object itself. + */ + public MarketplaceDetails withOfferDetails(OfferDetails offerDetails) { + this.offerDetails = offerDetails; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("offerDetails", this.offerDetails); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("saasResourceId", this.saasResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceDetails 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 MarketplaceDetails. + */ + public static MarketplaceDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceDetails deserializedMarketplaceDetails = new MarketplaceDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("offerDetails".equals(fieldName)) { + deserializedMarketplaceDetails.offerDetails = OfferDetails.fromJson(reader); + } else if ("subscriptionId".equals(fieldName)) { + deserializedMarketplaceDetails.subscriptionId = reader.getString(); + } else if ("subscriptionStatus".equals(fieldName)) { + deserializedMarketplaceDetails.subscriptionStatus + = MarketplaceSubscriptionStatus.fromString(reader.getString()); + } else if ("saasResourceId".equals(fieldName)) { + deserializedMarketplaceDetails.saasResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceDetails; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceSubscriptionStatus.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 000000000000..b3e4e37d5008 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Marketplace subscription status of a resource. + */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** + * Purchased but not yet activated. + */ + public static final MarketplaceSubscriptionStatus PENDING_FULFILLMENT_START = fromString("PendingFulfillmentStart"); + + /** + * Marketplace subscription is activated. + */ + public static final MarketplaceSubscriptionStatus SUBSCRIBED = fromString("Subscribed"); + + /** + * This state indicates that a customer's payment for the Marketplace service was not received. + */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Customer has cancelled the subscription. + */ + public static final MarketplaceSubscriptionStatus UNSUBSCRIBED = fromString("Unsubscribed"); + + /** + * Creates a new instance of MarketplaceSubscriptionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MarketplaceSubscriptionStatus() { + } + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** + * Gets known MarketplaceSubscriptionStatus values. + * + * @return known MarketplaceSubscriptionStatus values. + */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MatchType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MatchType.java new file mode 100644 index 000000000000..a689ec3adeed --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MatchType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The match type. + */ +public final class MatchType extends ExpandableStringEnum { + /** + * All rules should match. + */ + public static final MatchType ALL = fromString("all"); + + /** + * Any rule should match. + */ + public static final MatchType ANY = fromString("any"); + + /** + * Creates a new instance of MatchType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MatchType() { + } + + /** + * Creates or finds a MatchType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MatchType. + */ + public static MatchType fromString(String name) { + return fromString(name, MatchType.class); + } + + /** + * Gets known MatchType values. + * + * @return known MatchType values. + */ + public static Collection values() { + return values(MatchType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MonthOfYear.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MonthOfYear.java new file mode 100644 index 000000000000..97d1ac7a5a27 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MonthOfYear.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Month of Year Enum. + */ +public final class MonthOfYear extends ExpandableStringEnum { + /** + * First Month of the Year. + */ + public static final MonthOfYear JANUARY = fromString("JANUARY"); + + /** + * Second Month of the Year. + */ + public static final MonthOfYear FEBRUARY = fromString("FEBRUARY"); + + /** + * Third Month of the Year. + */ + public static final MonthOfYear MARCH = fromString("MARCH"); + + /** + * Fourth Month of the Year. + */ + public static final MonthOfYear APRIL = fromString("APRIL"); + + /** + * Fifth Month of the Year. + */ + public static final MonthOfYear MAY = fromString("MAY"); + + /** + * Sixth Month of the Year. + */ + public static final MonthOfYear JUNE = fromString("JUNE"); + + /** + * Seventh Month of the Year. + */ + public static final MonthOfYear JULY = fromString("JULY"); + + /** + * Eighth Month of the Year. + */ + public static final MonthOfYear AUGUST = fromString("AUGUST"); + + /** + * Ninth Month of the Year. + */ + public static final MonthOfYear SEPTEMBER = fromString("SEPTEMBER"); + + /** + * Tenth Month of the Year. + */ + public static final MonthOfYear OCTOBER = fromString("OCTOBER"); + + /** + * Eleventh Month of the Year. + */ + public static final MonthOfYear NOVEMBER = fromString("NOVEMBER"); + + /** + * Twelfth Month of the Year. + */ + public static final MonthOfYear DECEMBER = fromString("DECEMBER"); + + /** + * Creates a new instance of MonthOfYear value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MonthOfYear() { + } + + /** + * Creates or finds a MonthOfYear from its string representation. + * + * @param name a name to look for. + * @return the corresponding MonthOfYear. + */ + public static MonthOfYear fromString(String name) { + return fromString(name, MonthOfYear.class); + } + + /** + * Gets known MonthOfYear values. + * + * @return known MonthOfYear values. + */ + public static Collection values() { + return values(MonthOfYear.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OfferDetails.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OfferDetails.java new file mode 100644 index 000000000000..b25fe4ee6e86 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OfferDetails.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * Offer details for the marketplace that is selected by the user. + */ +@Fluent +public final class OfferDetails implements JsonSerializable { + /* + * Publisher Id for the marketplace offer + */ + private String publisherId; + + /* + * Offer Id for the marketplace offer + */ + private String offerId; + + /* + * Plan Id for the marketplace offer + */ + private String planId; + + /* + * Plan Name for the marketplace offer + */ + private String planName; + + /* + * Plan Display Name for the marketplace offer + */ + private String termUnit; + + /* + * Plan Display Name for the marketplace offer + */ + private String termId; + + /** + * Creates an instance of OfferDetails class. + */ + public OfferDetails() { + } + + /** + * Get the publisherId property: Publisher Id for the marketplace offer. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: Publisher Id for the marketplace offer. + * + * @param publisherId the publisherId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the offerId property: Offer Id for the marketplace offer. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: Offer Id for the marketplace offer. + * + * @param offerId the offerId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the planId property: Plan Id for the marketplace offer. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: Plan Id for the marketplace offer. + * + * @param planId the planId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the planName property: Plan Name for the marketplace offer. + * + * @return the planName value. + */ + public String planName() { + return this.planName; + } + + /** + * Set the planName property: Plan Name for the marketplace offer. + * + * @param planName the planName value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withPlanName(String planName) { + this.planName = planName; + return this; + } + + /** + * Get the termUnit property: Plan Display Name for the marketplace offer. + * + * @return the termUnit value. + */ + public String termUnit() { + return this.termUnit; + } + + /** + * Set the termUnit property: Plan Display Name for the marketplace offer. + * + * @param termUnit the termUnit value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withTermUnit(String termUnit) { + this.termUnit = termUnit; + return this; + } + + /** + * Get the termId property: Plan Display Name for the marketplace offer. + * + * @return the termId value. + */ + public String termId() { + return this.termId; + } + + /** + * Set the termId property: Plan Display Name for the marketplace offer. + * + * @param termId the termId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withTermId(String termId) { + this.termId = termId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publisherId", this.publisherId); + jsonWriter.writeStringField("offerId", this.offerId); + jsonWriter.writeStringField("planId", this.planId); + jsonWriter.writeStringField("planName", this.planName); + jsonWriter.writeStringField("termUnit", this.termUnit); + jsonWriter.writeStringField("termId", this.termId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferDetails 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 OfferDetails. + */ + public static OfferDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferDetails deserializedOfferDetails = new OfferDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publisherId".equals(fieldName)) { + deserializedOfferDetails.publisherId = reader.getString(); + } else if ("offerId".equals(fieldName)) { + deserializedOfferDetails.offerId = reader.getString(); + } else if ("planId".equals(fieldName)) { + deserializedOfferDetails.planId = reader.getString(); + } else if ("planName".equals(fieldName)) { + deserializedOfferDetails.planName = reader.getString(); + } else if ("termUnit".equals(fieldName)) { + deserializedOfferDetails.termUnit = reader.getString(); + } else if ("termId".equals(fieldName)) { + deserializedOfferDetails.termId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOfferDetails; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operation.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operation.java new file mode 100644 index 000000000000..73597057882a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.models; + +import com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OperationDisplay.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OperationDisplay.java new file mode 100644 index 000000000000..ddc9345e2880 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operations.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operations.java new file mode 100644 index 000000000000..1fa92876fb05 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operator.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operator.java new file mode 100644 index 000000000000..06524c642420 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operator.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The types of operator. + */ +public final class Operator extends ExpandableStringEnum { + /** + * The operator contains. + */ + public static final Operator CONTAINS = fromString("contains"); + + /** + * The operator does not contains. + */ + public static final Operator DOES_NOT_CONTAINS = fromString("doesNotContains"); + + /** + * The operator does not equal. + */ + public static final Operator DOES_NOT_EQUAL = fromString("doesNotEqual"); + + /** + * The operator starts with. + */ + public static final Operator STARTS_WITH = fromString("startsWith"); + + /** + * The operator ends with. + */ + public static final Operator ENDS_WITH = fromString("endsWith"); + + /** + * The operator equals. + */ + public static final Operator EQUALS = fromString("equals"); + + /** + * Creates a new instance of Operator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Operator() { + } + + /** + * Creates or finds a Operator from its string representation. + * + * @param name a name to look for. + * @return the corresponding Operator. + */ + public static Operator fromString(String name) { + return fromString(name, Operator.class); + } + + /** + * Gets known Operator values. + * + * @return known Operator values. + */ + public static Collection values() { + return values(Operator.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Origin.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Origin.java new file mode 100644 index 000000000000..ebfba1ed5d38 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/PlanProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/PlanProperties.java new file mode 100644 index 000000000000..14f9b233f7e0 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/PlanProperties.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 Commvault Plan. + */ +@Fluent +public final class PlanProperties implements JsonSerializable { + /* + * Location of the Commvault Plan + */ + private String location; + + /* + * The storage plans associated with the Commvault Plan + */ + private List storagePlans; + + /* + * The Commvault Plan Schedule + */ + private List schedules; + + /* + * The Commvault Plan Retention + */ + private Retention retention; + + /* + * Provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of PlanProperties class. + */ + public PlanProperties() { + } + + /** + * Get the location property: Location of the Commvault Plan. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the Commvault Plan. + * + * @param location the location value to set. + * @return the PlanProperties object itself. + */ + public PlanProperties withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the storagePlans property: The storage plans associated with the Commvault Plan. + * + * @return the storagePlans value. + */ + public List storagePlans() { + return this.storagePlans; + } + + /** + * Set the storagePlans property: The storage plans associated with the Commvault Plan. + * + * @param storagePlans the storagePlans value to set. + * @return the PlanProperties object itself. + */ + public PlanProperties withStoragePlans(List storagePlans) { + this.storagePlans = storagePlans; + return this; + } + + /** + * Get the schedules property: The Commvault Plan Schedule. + * + * @return the schedules value. + */ + public List schedules() { + return this.schedules; + } + + /** + * Set the schedules property: The Commvault Plan Schedule. + * + * @param schedules the schedules value to set. + * @return the PlanProperties object itself. + */ + public PlanProperties withSchedules(List schedules) { + this.schedules = schedules; + return this; + } + + /** + * Get the retention property: The Commvault Plan Retention. + * + * @return the retention value. + */ + public Retention retention() { + return this.retention; + } + + /** + * Set the retention property: The Commvault Plan Retention. + * + * @param retention the retention value to set. + * @return the PlanProperties object itself. + */ + public PlanProperties withRetention(Retention retention) { + this.retention = retention; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeArrayField("storagePlans", this.storagePlans, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("schedules", this.schedules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("retention", this.retention); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlanProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlanProperties 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 PlanProperties. + */ + public static PlanProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlanProperties deserializedPlanProperties = new PlanProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + deserializedPlanProperties.location = reader.getString(); + } else if ("storagePlans".equals(fieldName)) { + List storagePlans = reader.readArray(reader1 -> StoragePlan.fromJson(reader1)); + deserializedPlanProperties.storagePlans = storagePlans; + } else if ("schedules".equals(fieldName)) { + List schedules = reader.readArray(reader1 -> Schedule.fromJson(reader1)); + deserializedPlanProperties.schedules = schedules; + } else if ("retention".equals(fieldName)) { + deserializedPlanProperties.retention = Retention.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPlanProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPlanProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Plans.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Plans.java new file mode 100644 index 000000000000..7df3e76feccb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Plans.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 Plans. + */ +public interface Plans { + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String cloudAccountName, String planName, + Context context); + + /** + * Get a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 CommvaultPlan. + */ + CommvaultPlan get(String resourceGroupName, String cloudAccountName, String planName); + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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 delete(String resourceGroupName, String cloudAccountName, String planName); + + /** + * Delete a CommvaultPlan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param planName Name of the Plan 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. + */ + void delete(String resourceGroupName, String cloudAccountName, String planName, Context context); + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName); + + /** + * List CommvaultPlan resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 CommvaultPlan list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, Context context); + + /** + * Get a CommvaultPlan. + * + * @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 CommvaultPlan along with {@link Response}. + */ + CommvaultPlan getById(String id); + + /** + * Get a CommvaultPlan. + * + * @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 CommvaultPlan along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CommvaultPlan. + * + * @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 CommvaultPlan. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CommvaultPlan resource. + * + * @param name resource name. + * @return the first stage of the new CommvaultPlan definition. + */ + CommvaultPlan.DefinitionStages.Blank define(String name); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItem.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItem.java new file mode 100644 index 000000000000..4d0636b90757 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItem.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.commvaultcontentstore.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner; + +/** + * An immutable client-side representation of ProtectedItem. + */ +public interface ProtectedItem { + /** + * 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. + */ + ProtectedItemProperties 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.commvaultcontentstore.fluent.models.ProtectedItemInner object. + * + * @return the inner object. + */ + ProtectedItemInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemProperties.java new file mode 100644 index 000000000000..8e22c2dbe416 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemProperties.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.commvaultcontentstore.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Commvault Protected Item. + */ +@Immutable +public final class ProtectedItemProperties implements JsonSerializable { + /* + * The Name of the commvault protected item + */ + private String resourceName; + + /* + * The Commvault Protected Item backup time + */ + private long lastBackUpTime; + + /* + * The resource group of the protected item + */ + private String resourceGroup; + + /* + * The location of the protected item + */ + private String location; + + /* + * The GUID of VM + */ + private String vmGuid; + + /** + * Creates an instance of ProtectedItemProperties class. + */ + private ProtectedItemProperties() { + } + + /** + * Get the resourceName property: The Name of the commvault protected item. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the lastBackUpTime property: The Commvault Protected Item backup time. + * + * @return the lastBackUpTime value. + */ + public long lastBackUpTime() { + return this.lastBackUpTime; + } + + /** + * Get the resourceGroup property: The resource group of the protected item. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Get the location property: The location of the protected item. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the vmGuid property: The GUID of VM. + * + * @return the vmGuid value. + */ + public String vmGuid() { + return this.vmGuid; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectedItemProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectedItemProperties 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 ProtectedItemProperties. + */ + public static ProtectedItemProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectedItemProperties deserializedProtectedItemProperties = new ProtectedItemProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceName".equals(fieldName)) { + deserializedProtectedItemProperties.resourceName = reader.getString(); + } else if ("lastBackUpTime".equals(fieldName)) { + deserializedProtectedItemProperties.lastBackUpTime = reader.getLong(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedProtectedItemProperties.resourceGroup = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProtectedItemProperties.location = reader.getString(); + } else if ("vmGuid".equals(fieldName)) { + deserializedProtectedItemProperties.vmGuid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectedItemProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItems.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItems.java new file mode 100644 index 000000000000..e0e31c1183eb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItems.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.commvaultcontentstore.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 ProtectedItems. + */ +public interface ProtectedItems { + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context); + + /** + * Get a ProtectedItem. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ProtectedItem. + */ + ProtectedItem get(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName); + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName); + + /** + * List ProtectedItem resources by ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectedItem list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProtectionGroup(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item along with {@link Response}. + */ + Response getRestorePointsWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, Context context); + + /** + * Limits used for creation of resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore points of a Protected Item. + */ + RestorePoints getRestorePoints(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName); + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + Response restoreWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, String protectedItemName, RestoreProtectionItemRequest request, Context context); + + /** + * Restore resource for a protected item. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param protectedItemName The protectedItem Id, name of 2 protected items can be same under a PG if they belong to + * different resource group or even different data source types VM/DB/AKS, etc; and name is mandatory in Azure + * Typespec, hence using name parameter for id in Commvault In case of Vm it will be vmGuid. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + RestoreProtectionItemResponse restore(String resourceGroupName, String cloudAccountName, String protectionGroupName, + String protectedItemName, RestoreProtectionItemRequest request); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemsOperationGroups.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemsOperationGroups.java new file mode 100644 index 000000000000..e25348a8448d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemsOperationGroups.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ProtectedItemsOperationGroups. + */ +public interface ProtectedItemsOperationGroups { + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions along with + * {@link Response}. + */ + Response countByProtectionGroupsWithResponse(CountProtectedItemsRequest body, + Context context); + + /** + * Gets the count of protected items for provided CCA resource IDs across subscriptions. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of protected items for provided CCA resource IDs across subscriptions. + */ + CountProtectedItemsResponse countByProtectionGroups(CountProtectedItemsRequest body); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroup.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroup.java new file mode 100644 index 000000000000..bd60ec6d91b9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroup.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner; + +/** + * An immutable client-side representation of ProtectionGroup. + */ +public interface ProtectionGroup { + /** + * 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. + */ + ProtectionGroupProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner object. + * + * @return the inner object. + */ + ProtectionGroupInner innerModel(); + + /** + * The entirety of the ProtectionGroup definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The ProtectionGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ProtectionGroup definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ProtectionGroup definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, cloudAccountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @return the next definition stage. + */ + WithCreate withExistingCloudAccount(String resourceGroupName, String cloudAccountName); + } + + /** + * The stage of the ProtectionGroup 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ProtectionGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ProtectionGroup create(Context context); + } + + /** + * The stage of the ProtectionGroup 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(ProtectionGroupProperties properties); + } + } + + /** + * Begins update for the ProtectionGroup resource. + * + * @return the stage of resource update. + */ + ProtectionGroup.Update update(); + + /** + * The template for ProtectionGroup update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ProtectionGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ProtectionGroup apply(Context context); + } + + /** + * The ProtectionGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the ProtectionGroup update 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. + */ + Update withProperties(ProtectionGroupProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ProtectionGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ProtectionGroup refresh(Context context); + + /** + * Stop Backup for a Protection Group. + * + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stopBackup(StopBackupProtectionGroupRequest request); + + /** + * Stop Backup for a Protection Group. + * + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stopBackup(StopBackupProtectionGroupRequest request, Context context); + + /** + * Restore resource for a protected items in given protection group. + * + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + Response restoreWithResponse(RestoreProtectionItemRequest request, Context context); + + /** + * Restore resource for a protected items in given protection group. + * + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + RestoreProtectionItemResponse restore(RestoreProtectionItemRequest request); + + /** + * Resume Backup for a Protection Group. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response resumeBackupWithResponse(Context context); + + /** + * Resume Backup for a Protection Group. + * + * @throws com.azure.core.management.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 resumeBackup(); + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group along with {@link Response}. + */ + Response backupWithResponse(BackupProtectionGroupRequest request, Context context); + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group. + */ + BackupProtectionGroupResponse backup(BackupProtectionGroupRequest request); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupProperties.java new file mode 100644 index 000000000000..c16f820dafcf --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 properties of Commvault Protection Group. + */ +@Fluent +public final class ProtectionGroupProperties implements JsonSerializable { + /* + * The datasource type of Commvault Protection Group + */ + private final String dataSourceType = "AzureVM"; + + /* + * The Commvault Plan to be associated with the Protection Group + */ + private String plan; + + /* + * The resources to be protected under Protection Group + */ + private ProtectionGroupResources resources; + + /* + * The protection group schedule + */ + private ProtectionStatus protectionStatus; + + /* + * The number of ProtectedItems under the Protection Group + */ + private Integer numberOfProtectedItems; + + /* + * The Commvault Protection Group backup time + */ + private Long lastBackUpTime; + + /* + * The backup activity status indicating if backup is enabled or not on the protection group + */ + private String backupActivityStatus; + + /* + * Provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of ProtectionGroupProperties class. + */ + public ProtectionGroupProperties() { + } + + /** + * Get the dataSourceType property: The datasource type of Commvault Protection Group. + * + * @return the dataSourceType value. + */ + public String dataSourceType() { + return this.dataSourceType; + } + + /** + * Get the plan property: The Commvault Plan to be associated with the Protection Group. + * + * @return the plan value. + */ + public String plan() { + return this.plan; + } + + /** + * Set the plan property: The Commvault Plan to be associated with the Protection Group. + * + * @param plan the plan value to set. + * @return the ProtectionGroupProperties object itself. + */ + public ProtectionGroupProperties withPlan(String plan) { + this.plan = plan; + return this; + } + + /** + * Get the resources property: The resources to be protected under Protection Group. + * + * @return the resources value. + */ + public ProtectionGroupResources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources to be protected under Protection Group. + * + * @param resources the resources value to set. + * @return the ProtectionGroupProperties object itself. + */ + public ProtectionGroupProperties withResources(ProtectionGroupResources resources) { + this.resources = resources; + return this; + } + + /** + * Get the protectionStatus property: The protection group schedule. + * + * @return the protectionStatus value. + */ + public ProtectionStatus protectionStatus() { + return this.protectionStatus; + } + + /** + * Get the numberOfProtectedItems property: The number of ProtectedItems under the Protection Group. + * + * @return the numberOfProtectedItems value. + */ + public Integer numberOfProtectedItems() { + return this.numberOfProtectedItems; + } + + /** + * Get the lastBackUpTime property: The Commvault Protection Group backup time. + * + * @return the lastBackUpTime value. + */ + public Long lastBackUpTime() { + return this.lastBackUpTime; + } + + /** + * Get the backupActivityStatus property: The backup activity status indicating if backup is enabled or not on the + * protection group. + * + * @return the backupActivityStatus value. + */ + public String backupActivityStatus() { + return this.backupActivityStatus; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataSourceType", this.dataSourceType); + jsonWriter.writeStringField("plan", this.plan); + jsonWriter.writeJsonField("resources", this.resources); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionGroupProperties 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 ProtectionGroupProperties. + */ + public static ProtectionGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionGroupProperties deserializedProtectionGroupProperties = new ProtectionGroupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("plan".equals(fieldName)) { + deserializedProtectionGroupProperties.plan = reader.getString(); + } else if ("resources".equals(fieldName)) { + deserializedProtectionGroupProperties.resources = ProtectionGroupResources.fromJson(reader); + } else if ("protectionStatus".equals(fieldName)) { + deserializedProtectionGroupProperties.protectionStatus + = ProtectionStatus.fromString(reader.getString()); + } else if ("numberOfProtectedItems".equals(fieldName)) { + deserializedProtectionGroupProperties.numberOfProtectedItems + = reader.getNullable(JsonReader::getInt); + } else if ("lastBackUpTime".equals(fieldName)) { + deserializedProtectionGroupProperties.lastBackUpTime = reader.getNullable(JsonReader::getLong); + } else if ("backupActivityStatus".equals(fieldName)) { + deserializedProtectionGroupProperties.backupActivityStatus = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedProtectionGroupProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionGroupProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResources.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResources.java new file mode 100644 index 000000000000..377200fe553d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResources.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 resources to be protected under Protection Group. + */ +@Fluent +public final class ProtectionGroupResources implements JsonSerializable { + /* + * The items to be protected under Protection Group + */ + private List manual; + + /* + * Rules to match resources + */ + private ProtectionGroupResourcesMatchRules matchRules; + + /** + * Creates an instance of ProtectionGroupResources class. + */ + public ProtectionGroupResources() { + } + + /** + * Get the manual property: The items to be protected under Protection Group. + * + * @return the manual value. + */ + public List manual() { + return this.manual; + } + + /** + * Set the manual property: The items to be protected under Protection Group. + * + * @param manual the manual value to set. + * @return the ProtectionGroupResources object itself. + */ + public ProtectionGroupResources withManual(List manual) { + this.manual = manual; + return this; + } + + /** + * Get the matchRules property: Rules to match resources. + * + * @return the matchRules value. + */ + public ProtectionGroupResourcesMatchRules matchRules() { + return this.matchRules; + } + + /** + * Set the matchRules property: Rules to match resources. + * + * @param matchRules the matchRules value to set. + * @return the ProtectionGroupResources object itself. + */ + public ProtectionGroupResources withMatchRules(ProtectionGroupResourcesMatchRules matchRules) { + this.matchRules = matchRules; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("manual", this.manual, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("matchRules", this.matchRules); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionGroupResources from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionGroupResources 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 ProtectionGroupResources. + */ + public static ProtectionGroupResources fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionGroupResources deserializedProtectionGroupResources = new ProtectionGroupResources(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("manual".equals(fieldName)) { + List manual = reader.readArray(reader1 -> reader1.getString()); + deserializedProtectionGroupResources.manual = manual; + } else if ("matchRules".equals(fieldName)) { + deserializedProtectionGroupResources.matchRules + = ProtectionGroupResourcesMatchRules.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionGroupResources; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResourcesMatchRules.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResourcesMatchRules.java new file mode 100644 index 000000000000..081d72f62d4c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResourcesMatchRules.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 ProtectionGroupResourcesMatchRules model. + */ +@Fluent +public final class ProtectionGroupResourcesMatchRules implements JsonSerializable { + /* + * rules to match + */ + private List rules; + + /* + * match Type all or any + */ + private MatchType matchType; + + /** + * Creates an instance of ProtectionGroupResourcesMatchRules class. + */ + public ProtectionGroupResourcesMatchRules() { + } + + /** + * Get the rules property: rules to match. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: rules to match. + * + * @param rules the rules value to set. + * @return the ProtectionGroupResourcesMatchRules object itself. + */ + public ProtectionGroupResourcesMatchRules withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the matchType property: match Type all or any. + * + * @return the matchType value. + */ + public MatchType matchType() { + return this.matchType; + } + + /** + * Set the matchType property: match Type all or any. + * + * @param matchType the matchType value to set. + * @return the ProtectionGroupResourcesMatchRules object itself. + */ + public ProtectionGroupResourcesMatchRules withMatchType(MatchType matchType) { + this.matchType = matchType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("rules", this.rules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("matchType", this.matchType == null ? null : this.matchType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProtectionGroupResourcesMatchRules from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProtectionGroupResourcesMatchRules 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 ProtectionGroupResourcesMatchRules. + */ + public static ProtectionGroupResourcesMatchRules fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProtectionGroupResourcesMatchRules deserializedProtectionGroupResourcesMatchRules + = new ProtectionGroupResourcesMatchRules(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rules".equals(fieldName)) { + List rules = reader.readArray(reader1 -> Rule.fromJson(reader1)); + deserializedProtectionGroupResourcesMatchRules.rules = rules; + } else if ("matchType".equals(fieldName)) { + deserializedProtectionGroupResourcesMatchRules.matchType = MatchType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProtectionGroupResourcesMatchRules; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroups.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroups.java new file mode 100644 index 000000000000..dd2402ac3f12 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroups.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 ProtectionGroups. + */ +public interface ProtectionGroups { + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Get a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 ProtectionGroup. + */ + ProtectionGroup get(String resourceGroupName, String cloudAccountName, String protectionGroupName); + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 delete(String resourceGroupName, String cloudAccountName, String protectionGroupName); + + /** + * Delete a ProtectionGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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. + */ + void delete(String resourceGroupName, String cloudAccountName, String protectionGroupName, Context context); + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName); + + /** + * List ProtectionGroup resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 ProtectionGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, + Context context); + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request); + + /** + * Stop Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stopBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + StopBackupProtectionGroupRequest request, Context context); + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item along with {@link Response}. + */ + Response restoreWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, RestoreProtectionItemRequest request, Context context); + + /** + * Restore resource for a protected items in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore resource response for a Protected Item. + */ + RestoreProtectionItemResponse restore(String resourceGroupName, String cloudAccountName, String protectionGroupName, + RestoreProtectionItemRequest request); + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 {@link Response}. + */ + Response resumeBackupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, Context context); + + /** + * Resume Backup for a Protection Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup 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 resumeBackup(String resourceGroupName, String cloudAccountName, String protectionGroupName); + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group along with {@link Response}. + */ + Response backupWithResponse(String resourceGroupName, String cloudAccountName, + String protectionGroupName, BackupProtectionGroupRequest request, Context context); + + /** + * Ad-hoc backup of protected items resource in given protection group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param protectionGroupName Name of the ProtectionGroup resource. + * @param request The body type of the operation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup job response for a Protection Group. + */ + BackupProtectionGroupResponse backup(String resourceGroupName, String cloudAccountName, String protectionGroupName, + BackupProtectionGroupRequest request); + + /** + * Get a ProtectionGroup. + * + * @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 ProtectionGroup along with {@link Response}. + */ + ProtectionGroup getById(String id); + + /** + * Get a ProtectionGroup. + * + * @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 ProtectionGroup along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ProtectionGroup. + * + * @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 ProtectionGroup. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ProtectionGroup resource. + * + * @param name resource name. + * @return the first stage of the new ProtectionGroup definition. + */ + ProtectionGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionStatus.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionStatus.java new file mode 100644 index 000000000000..3f1d5b206c95 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionStatus.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Protection Status. + */ +public final class ProtectionStatus extends ExpandableStringEnum { + /** + * The protection group status is All. + */ + public static final ProtectionStatus ALL = fromString("all"); + + /** + * The protection group status is Protected. + */ + public static final ProtectionStatus PROTECTED = fromString("protected"); + + /** + * The protection group status is Not Protected. + */ + public static final ProtectionStatus NOT_PROTECTED = fromString("not_protected"); + + /** + * The protection group status is Pending. + */ + public static final ProtectionStatus PENDING = fromString("pending"); + + /** + * The protection group status is backed_up_with_error. + */ + public static final ProtectionStatus BACKED_UP_WITH_ERROR = fromString("backed_up_with_error"); + + /** + * The protection group status is discovered. + */ + public static final ProtectionStatus DISCOVERED = fromString("discovered"); + + /** + * Creates a new instance of ProtectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProtectionStatus() { + } + + /** + * Creates or finds a ProtectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProtectionStatus. + */ + public static ProtectionStatus fromString(String name) { + return fromString(name, ProtectionStatus.class); + } + + /** + * Gets known ProtectionStatus values. + * + * @return known ProtectionStatus values. + */ + public static Collection values() { + return values(ProtectionStatus.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ResourceProvisioningState.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ResourceProvisioningState.java new file mode 100644 index 000000000000..c2db1fe058e6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ResourceProvisioningState.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestorePoints.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestorePoints.java new file mode 100644 index 000000000000..a28f3cc0144a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestorePoints.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.commvaultcontentstore.models; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner; +import java.util.List; + +/** + * An immutable client-side representation of RestorePoints. + */ +public interface RestorePoints { + /** + * Gets the restoreTimes property: The Commvault Protected Item Restore points. + * + * @return the restoreTimes value. + */ + List restoreTimes(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner object. + * + * @return the inner object. + */ + RestorePointsInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemRequest.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemRequest.java new file mode 100644 index 000000000000..42ccbbc756a8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemRequest.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 properties of RestoreProtectionItemRequest. + */ +@Fluent +public final class RestoreProtectionItemRequest implements JsonSerializable { + /* + * Check whether inplace or out of place restore. + */ + private boolean inPlaceRestore; + + /* + * Type of Restore + */ + private RestoreType restoreType; + + /* + * Time to restore + */ + private String toTime; + + /* + * The vm destination details of the VM. + */ + private VmDestinationInfo vmDestinationInfo; + + /** + * Creates an instance of RestoreProtectionItemRequest class. + */ + public RestoreProtectionItemRequest() { + } + + /** + * Get the inPlaceRestore property: Check whether inplace or out of place restore. + * + * @return the inPlaceRestore value. + */ + public boolean inPlaceRestore() { + return this.inPlaceRestore; + } + + /** + * Set the inPlaceRestore property: Check whether inplace or out of place restore. + * + * @param inPlaceRestore the inPlaceRestore value to set. + * @return the RestoreProtectionItemRequest object itself. + */ + public RestoreProtectionItemRequest withInPlaceRestore(boolean inPlaceRestore) { + this.inPlaceRestore = inPlaceRestore; + return this; + } + + /** + * Get the restoreType property: Type of Restore. + * + * @return the restoreType value. + */ + public RestoreType restoreType() { + return this.restoreType; + } + + /** + * Set the restoreType property: Type of Restore. + * + * @param restoreType the restoreType value to set. + * @return the RestoreProtectionItemRequest object itself. + */ + public RestoreProtectionItemRequest withRestoreType(RestoreType restoreType) { + this.restoreType = restoreType; + return this; + } + + /** + * Get the toTime property: Time to restore. + * + * @return the toTime value. + */ + public String toTime() { + return this.toTime; + } + + /** + * Set the toTime property: Time to restore. + * + * @param toTime the toTime value to set. + * @return the RestoreProtectionItemRequest object itself. + */ + public RestoreProtectionItemRequest withToTime(String toTime) { + this.toTime = toTime; + return this; + } + + /** + * Get the vmDestinationInfo property: The vm destination details of the VM. + * + * @return the vmDestinationInfo value. + */ + public VmDestinationInfo vmDestinationInfo() { + return this.vmDestinationInfo; + } + + /** + * Set the vmDestinationInfo property: The vm destination details of the VM. + * + * @param vmDestinationInfo the vmDestinationInfo value to set. + * @return the RestoreProtectionItemRequest object itself. + */ + public RestoreProtectionItemRequest withVmDestinationInfo(VmDestinationInfo vmDestinationInfo) { + this.vmDestinationInfo = vmDestinationInfo; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("inPlaceRestore", this.inPlaceRestore); + jsonWriter.writeJsonField("vmDestinationInfo", this.vmDestinationInfo); + jsonWriter.writeStringField("restoreType", this.restoreType == null ? null : this.restoreType.toString()); + jsonWriter.writeStringField("toTime", this.toTime); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreProtectionItemRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreProtectionItemRequest 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 RestoreProtectionItemRequest. + */ + public static RestoreProtectionItemRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreProtectionItemRequest deserializedRestoreProtectionItemRequest = new RestoreProtectionItemRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inPlaceRestore".equals(fieldName)) { + deserializedRestoreProtectionItemRequest.inPlaceRestore = reader.getBoolean(); + } else if ("vmDestinationInfo".equals(fieldName)) { + deserializedRestoreProtectionItemRequest.vmDestinationInfo = VmDestinationInfo.fromJson(reader); + } else if ("restoreType".equals(fieldName)) { + deserializedRestoreProtectionItemRequest.restoreType = RestoreType.fromString(reader.getString()); + } else if ("toTime".equals(fieldName)) { + deserializedRestoreProtectionItemRequest.toTime = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreProtectionItemRequest; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemResponse.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemResponse.java new file mode 100644 index 000000000000..997ad0290ccb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemResponse.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.commvaultcontentstore.models; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of RestoreProtectionItemResponse. + */ +public interface RestoreProtectionItemResponse { + /** + * Gets the taskId property: The Commvault response for taskId. + * + * @return the taskId value. + */ + int taskId(); + + /** + * Gets the jobIds property: The jobIds returned from Commvault. + * + * @return the jobIds value. + */ + List jobIds(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner + * object. + * + * @return the inner object. + */ + RestoreProtectionItemResponseInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreType.java new file mode 100644 index 000000000000..9a2ceeeb4d8b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of Restore Supported. + */ +public final class RestoreType extends ExpandableStringEnum { + /** + * Azure In place Restore. + */ + public static final RestoreType NONE = fromString("NONE"); + + /** + * Azure Out of Place. + */ + public static final RestoreType VIRTUAL_MACHINE = fromString("VIRTUAL_MACHINE"); + + /** + * Azure Attach disk restore to existing VM. + */ + public static final RestoreType DISK_ATTACH = fromString("DISK_ATTACH"); + + /** + * Creates a new instance of RestoreType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RestoreType() { + } + + /** + * Creates or finds a RestoreType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreType. + */ + public static RestoreType fromString(String name) { + return fromString(name, RestoreType.class); + } + + /** + * Gets known RestoreType values. + * + * @return known RestoreType values. + */ + public static Collection values() { + return values(RestoreType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Retention.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Retention.java new file mode 100644 index 000000000000..577dab120103 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Retention.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * A Commvault Plan Retention Model. + */ +@Fluent +public final class Retention implements JsonSerializable { + /* + * Number of Snapshots + */ + private Integer numberOfSnapshots; + + /** + * Creates an instance of Retention class. + */ + public Retention() { + } + + /** + * Get the numberOfSnapshots property: Number of Snapshots. + * + * @return the numberOfSnapshots value. + */ + public Integer numberOfSnapshots() { + return this.numberOfSnapshots; + } + + /** + * Set the numberOfSnapshots property: Number of Snapshots. + * + * @param numberOfSnapshots the numberOfSnapshots value to set. + * @return the Retention object itself. + */ + public Retention withNumberOfSnapshots(Integer numberOfSnapshots) { + this.numberOfSnapshots = numberOfSnapshots; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("numberOfSnapshots", this.numberOfSnapshots); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Retention from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Retention 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 Retention. + */ + public static Retention fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Retention deserializedRetention = new Retention(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("numberOfSnapshots".equals(fieldName)) { + deserializedRetention.numberOfSnapshots = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedRetention; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RetentionTime.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RetentionTime.java new file mode 100644 index 000000000000..fc555a82148a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RetentionTime.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The retention time for Commvault Plan. + */ +public final class RetentionTime extends ExpandableStringEnum { + /** + * Monthly retention time. + */ + public static final RetentionTime MONTHLY = fromString("monthly"); + + /** + * Yearly retention time. + */ + public static final RetentionTime YEARLY = fromString("yearly"); + + /** + * Creates a new instance of RetentionTime value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RetentionTime() { + } + + /** + * Creates or finds a RetentionTime from its string representation. + * + * @param name a name to look for. + * @return the corresponding RetentionTime. + */ + public static RetentionTime fromString(String name) { + return fromString(name, RetentionTime.class); + } + + /** + * Gets known RetentionTime values. + * + * @return known RetentionTime values. + */ + public static Collection values() { + return values(RetentionTime.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleAssignment.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleAssignment.java new file mode 100644 index 000000000000..48128bb0fd47 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleAssignment.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * A role assignment mapping a Commvault role to one or more Entra entities (users or groups). + */ +@Fluent +public final class RoleAssignment implements JsonSerializable { + /* + * The name of the Commvault role + */ + private RoleName roleName; + + /* + * The Entra entities (users or groups) assigned to this role + */ + private List entities; + + /** + * Creates an instance of RoleAssignment class. + */ + public RoleAssignment() { + } + + /** + * Get the roleName property: The name of the Commvault role. + * + * @return the roleName value. + */ + public RoleName roleName() { + return this.roleName; + } + + /** + * Set the roleName property: The name of the Commvault role. + * + * @param roleName the roleName value to set. + * @return the RoleAssignment object itself. + */ + public RoleAssignment withRoleName(RoleName roleName) { + this.roleName = roleName; + return this; + } + + /** + * Get the entities property: The Entra entities (users or groups) assigned to this role. + * + * @return the entities value. + */ + public List entities() { + return this.entities; + } + + /** + * Set the entities property: The Entra entities (users or groups) assigned to this role. + * + * @param entities the entities value to set. + * @return the RoleAssignment object itself. + */ + public RoleAssignment withEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("roleName", this.roleName == null ? null : this.roleName.toString()); + jsonWriter.writeArrayField("entities", this.entities, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RoleAssignment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoleAssignment 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 RoleAssignment. + */ + public static RoleAssignment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RoleAssignment deserializedRoleAssignment = new RoleAssignment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roleName".equals(fieldName)) { + deserializedRoleAssignment.roleName = RoleName.fromString(reader.getString()); + } else if ("entities".equals(fieldName)) { + List entities = reader.readArray(reader1 -> EntityInfo.fromJson(reader1)); + deserializedRoleAssignment.entities = entities; + } else { + reader.skipChildren(); + } + } + + return deserializedRoleAssignment; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMapping.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMapping.java new file mode 100644 index 000000000000..334f38bc9b5b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMapping.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.commvaultcontentstore.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; + +/** + * An immutable client-side representation of RoleMapping. + */ +public interface RoleMapping { + /** + * 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. + */ + RoleMappingProperties 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.commvaultcontentstore.fluent.models.RoleMappingInner object. + * + * @return the inner object. + */ + RoleMappingInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappingProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappingProperties.java new file mode 100644 index 000000000000..4960f09ced72 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappingProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 Commvault Role Mapping. + */ +@Fluent +public final class RoleMappingProperties implements JsonSerializable { + /* + * The list of role assignments mapping roles to Entra entities (users and groups) + */ + private List roles; + + /* + * Provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of RoleMappingProperties class. + */ + public RoleMappingProperties() { + } + + /** + * Get the roles property: The list of role assignments mapping roles to Entra entities (users and groups). + * + * @return the roles value. + */ + public List roles() { + return this.roles; + } + + /** + * Set the roles property: The list of role assignments mapping roles to Entra entities (users and groups). + * + * @param roles the roles value to set. + * @return the RoleMappingProperties object itself. + */ + public RoleMappingProperties withRoles(List roles) { + this.roles = roles; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("roles", this.roles, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RoleMappingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoleMappingProperties 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 RoleMappingProperties. + */ + public static RoleMappingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RoleMappingProperties deserializedRoleMappingProperties = new RoleMappingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roles".equals(fieldName)) { + List roles = reader.readArray(reader1 -> RoleAssignment.fromJson(reader1)); + deserializedRoleMappingProperties.roles = roles; + } else if ("provisioningState".equals(fieldName)) { + deserializedRoleMappingProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRoleMappingProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappings.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappings.java new file mode 100644 index 000000000000..7ebbba3fb283 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappings.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; + +/** + * Resource collection API of RoleMappings. + */ +public interface RoleMappings { + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String cloudAccountName, Context context); + + /** + * Get a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping. + */ + RoleMapping get(String resourceGroupName, String cloudAccountName); + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Commvault Role Mapping Resource along with {@link Response}. + */ + Response createOrUpdateWithResponse(String resourceGroupName, String cloudAccountName, + RoleMappingInner resource, Context context); + + /** + * Create a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 a Commvault Role Mapping Resource. + */ + RoleMapping createOrUpdate(String resourceGroupName, String cloudAccountName, RoleMappingInner resource); + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String cloudAccountName, + Context context); + + /** + * Delete a RoleMapping. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 cloudAccountName); + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String cloudAccountName); + + /** + * List RoleMapping resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 RoleMapping list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String cloudAccountName, Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleName.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleName.java new file mode 100644 index 000000000000..624b82e62c56 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleName.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Supported Commvault role names. + */ +public final class RoleName extends ExpandableStringEnum { + /** + * Backup Administrator - full access to all resources. + */ + public static final RoleName BACKUP_ADMIN = fromString("BackupAdmin"); + + /** + * Backup Operator - can manage resources but cannot delete storage or plans. + */ + public static final RoleName BACKUP_OPERATOR = fromString("BackupOperator"); + + /** + * Backup User - can manage protection groups, read-only on plans and storage. + */ + public static final RoleName BACKUP_USER = fromString("BackupUser"); + + /** + * Security Administrator - can manage CCA enrollment and user management. + */ + public static final RoleName SECURITY_ADMIN = fromString("SecurityAdmin"); + + /** + * MPA Administrator - can authorize critical operations protected by MPA. + */ + public static final RoleName MULTI_PERSON_AUTHORIZATION = fromString("MultiPersonAuthorization"); + + /** + * Creates a new instance of RoleName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RoleName() { + } + + /** + * Creates or finds a RoleName from its string representation. + * + * @param name a name to look for. + * @return the corresponding RoleName. + */ + public static RoleName fromString(String name) { + return fromString(name, RoleName.class); + } + + /** + * Gets known RoleName values. + * + * @return known RoleName values. + */ + public static Collection values() { + return values(RoleName.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Rule.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Rule.java new file mode 100644 index 000000000000..b61efa6ff12c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Rule.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 rules to match resources. + */ +@Fluent +public final class Rule implements JsonSerializable { + /* + * property of the rule + */ + private RuleProperty property; + + /* + * property of the rule + */ + private Operator operator; + + /* + * property of the rule + */ + private String value; + + /** + * Creates an instance of Rule class. + */ + public Rule() { + } + + /** + * Get the property property: property of the rule. + * + * @return the property value. + */ + public RuleProperty property() { + return this.property; + } + + /** + * Set the property property: property of the rule. + * + * @param property the property value to set. + * @return the Rule object itself. + */ + public Rule withProperty(RuleProperty property) { + this.property = property; + return this; + } + + /** + * Get the operator property: property of the rule. + * + * @return the operator value. + */ + public Operator operator() { + return this.operator; + } + + /** + * Set the operator property: property of the rule. + * + * @param operator the operator value to set. + * @return the Rule object itself. + */ + public Rule withOperator(Operator operator) { + this.operator = operator; + return this; + } + + /** + * Get the value property: property of the rule. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: property of the rule. + * + * @param value the value value to set. + * @return the Rule object itself. + */ + public Rule withValue(String value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString()); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Rule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Rule 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 Rule. + */ + public static Rule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Rule deserializedRule = new Rule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedRule.property = RuleProperty.fromString(reader.getString()); + } else if ("operator".equals(fieldName)) { + deserializedRule.operator = Operator.fromString(reader.getString()); + } else if ("value".equals(fieldName)) { + deserializedRule.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRule; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RuleProperty.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RuleProperty.java new file mode 100644 index 000000000000..2dae1797363b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RuleProperty.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Rule property. + */ +public final class RuleProperty extends ExpandableStringEnum { + /** + * The resource group of the rule. + */ + public static final RuleProperty RESOURCE_GROUP = fromString("resourceGroup"); + + /** + * The name of the rule. + */ + public static final RuleProperty NAME = fromString("name"); + + /** + * The tag name of the rule. + */ + public static final RuleProperty TAG_NAME = fromString("tagName"); + + /** + * The tag value of the rule. + */ + public static final RuleProperty TAG_VALUE = fromString("tagValue"); + + /** + * The region of the rule. + */ + public static final RuleProperty REGION = fromString("region"); + + /** + * The status of the rule. + */ + public static final RuleProperty STATUS = fromString("status"); + + /** + * Creates a new instance of RuleProperty value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RuleProperty() { + } + + /** + * Creates or finds a RuleProperty from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleProperty. + */ + public static RuleProperty fromString(String name) { + return fromString(name, RuleProperty.class); + } + + /** + * Gets known RuleProperty values. + * + * @return known RuleProperty values. + */ + public static Collection values() { + return values(RuleProperty.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSData.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSData.java new file mode 100644 index 000000000000..c3fdb3a959c9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSData.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * SaaS-related data properties. + */ +@Fluent +public final class SaaSData implements JsonSerializable { + /* + * SaaS resource id + */ + private String saaSResourceId; + + /** + * Creates an instance of SaaSData class. + */ + public SaaSData() { + } + + /** + * Get the saaSResourceId property: SaaS resource id. + * + * @return the saaSResourceId value. + */ + public String saaSResourceId() { + return this.saaSResourceId; + } + + /** + * Set the saaSResourceId property: SaaS resource id. + * + * @param saaSResourceId the saaSResourceId value to set. + * @return the SaaSData object itself. + */ + public SaaSData withSaaSResourceId(String saaSResourceId) { + this.saaSResourceId = saaSResourceId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("saaSResourceId", this.saaSResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SaaSData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SaaSData 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 SaaSData. + */ + public static SaaSData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SaaSData deserializedSaaSData = new SaaSData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("saaSResourceId".equals(fieldName)) { + deserializedSaaSData.saaSResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSaaSData; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSOperationGroups.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSOperationGroups.java new file mode 100644 index 000000000000..30167b7a2215 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSOperationGroups.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.commvaultcontentstore.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of SaaSOperationGroups. + */ +public interface SaaSOperationGroups { + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details. + */ + SaaSResourceDetailsResponse activateResource(ActivateSaaSParameterRequest body); + + /** + * Resolve the token to get the SaaS resource ID and activate the SaaS resource. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return marketplace SaaS resource details. + */ + SaaSResourceDetailsResponse activateResource(ActivateSaaSParameterRequest body, Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSResourceDetailsResponse.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSResourceDetailsResponse.java new file mode 100644 index 000000000000..ca931da41215 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSResourceDetailsResponse.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.commvaultcontentstore.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner; + +/** + * An immutable client-side representation of SaaSResourceDetailsResponse. + */ +public interface SaaSResourceDetailsResponse { + /** + * 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 saaSResourceId property: Id of the Marketplace SaaS Resource. + * + * @return the saaSResourceId value. + */ + String saaSResourceId(); + + /** + * 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.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner + * object. + * + * @return the inner object. + */ + SaaSResourceDetailsResponseInner innerModel(); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Schedule.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Schedule.java new file mode 100644 index 000000000000..9165ecef68bc --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Schedule.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * A Commvault Plan Schedule Model. + */ +@Fluent +public final class Schedule implements JsonSerializable { + /* + * Type of Backup + */ + private BackUpType backupType; + + /* + * Frequency of Retention + */ + private Frequency frequency; + + /* + * Interval of Retention + */ + private Integer runsEvery; + + /* + * Week of the month + */ + private WeekOfMonth weekOfMonth; + + /* + * Day of the week + */ + private DayOfWeek dayOfWeek; + + /* + * Month of the year + */ + private MonthOfYear monthOfYear; + + /* + * Day of the month + */ + private Integer dayOfMonth; + + /* + * Weekly Days List + */ + private List weeklyDays; + + /* + * Time of Retention + */ + private String time; + + /* + * Time Zone + */ + private String timeZone; + + /** + * Creates an instance of Schedule class. + */ + public Schedule() { + } + + /** + * Get the backupType property: Type of Backup. + * + * @return the backupType value. + */ + public BackUpType backupType() { + return this.backupType; + } + + /** + * Set the backupType property: Type of Backup. + * + * @param backupType the backupType value to set. + * @return the Schedule object itself. + */ + public Schedule withBackupType(BackUpType backupType) { + this.backupType = backupType; + return this; + } + + /** + * Get the frequency property: Frequency of Retention. + * + * @return the frequency value. + */ + public Frequency frequency() { + return this.frequency; + } + + /** + * Set the frequency property: Frequency of Retention. + * + * @param frequency the frequency value to set. + * @return the Schedule object itself. + */ + public Schedule withFrequency(Frequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the runsEvery property: Interval of Retention. + * + * @return the runsEvery value. + */ + public Integer runsEvery() { + return this.runsEvery; + } + + /** + * Set the runsEvery property: Interval of Retention. + * + * @param runsEvery the runsEvery value to set. + * @return the Schedule object itself. + */ + public Schedule withRunsEvery(Integer runsEvery) { + this.runsEvery = runsEvery; + return this; + } + + /** + * Get the weekOfMonth property: Week of the month. + * + * @return the weekOfMonth value. + */ + public WeekOfMonth weekOfMonth() { + return this.weekOfMonth; + } + + /** + * Set the weekOfMonth property: Week of the month. + * + * @param weekOfMonth the weekOfMonth value to set. + * @return the Schedule object itself. + */ + public Schedule withWeekOfMonth(WeekOfMonth weekOfMonth) { + this.weekOfMonth = weekOfMonth; + return this; + } + + /** + * Get the dayOfWeek property: Day of the week. + * + * @return the dayOfWeek value. + */ + public DayOfWeek dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: Day of the week. + * + * @param dayOfWeek the dayOfWeek value to set. + * @return the Schedule object itself. + */ + public Schedule withDayOfWeek(DayOfWeek dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Get the monthOfYear property: Month of the year. + * + * @return the monthOfYear value. + */ + public MonthOfYear monthOfYear() { + return this.monthOfYear; + } + + /** + * Set the monthOfYear property: Month of the year. + * + * @param monthOfYear the monthOfYear value to set. + * @return the Schedule object itself. + */ + public Schedule withMonthOfYear(MonthOfYear monthOfYear) { + this.monthOfYear = monthOfYear; + return this; + } + + /** + * Get the dayOfMonth property: Day of the month. + * + * @return the dayOfMonth value. + */ + public Integer dayOfMonth() { + return this.dayOfMonth; + } + + /** + * Set the dayOfMonth property: Day of the month. + * + * @param dayOfMonth the dayOfMonth value to set. + * @return the Schedule object itself. + */ + public Schedule withDayOfMonth(Integer dayOfMonth) { + this.dayOfMonth = dayOfMonth; + return this; + } + + /** + * Get the weeklyDays property: Weekly Days List. + * + * @return the weeklyDays value. + */ + public List weeklyDays() { + return this.weeklyDays; + } + + /** + * Set the weeklyDays property: Weekly Days List. + * + * @param weeklyDays the weeklyDays value to set. + * @return the Schedule object itself. + */ + public Schedule withWeeklyDays(List weeklyDays) { + this.weeklyDays = weeklyDays; + return this; + } + + /** + * Get the time property: Time of Retention. + * + * @return the time value. + */ + public String time() { + return this.time; + } + + /** + * Set the time property: Time of Retention. + * + * @param time the time value to set. + * @return the Schedule object itself. + */ + public Schedule withTime(String time) { + this.time = time; + return this; + } + + /** + * Get the timeZone property: Time Zone. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Time Zone. + * + * @param timeZone the timeZone value to set. + * @return the Schedule object itself. + */ + public Schedule withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("backupType", this.backupType == null ? null : this.backupType.toString()); + jsonWriter.writeStringField("frequency", this.frequency == null ? null : this.frequency.toString()); + jsonWriter.writeNumberField("runsEvery", this.runsEvery); + jsonWriter.writeStringField("weekOfMonth", this.weekOfMonth == null ? null : this.weekOfMonth.toString()); + jsonWriter.writeStringField("dayOfWeek", this.dayOfWeek == null ? null : this.dayOfWeek.toString()); + jsonWriter.writeStringField("monthOfYear", this.monthOfYear == null ? null : this.monthOfYear.toString()); + jsonWriter.writeNumberField("dayOfMonth", this.dayOfMonth); + jsonWriter.writeArrayField("weeklyDays", this.weeklyDays, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("time", this.time); + jsonWriter.writeStringField("timeZone", this.timeZone); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Schedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Schedule 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 Schedule. + */ + public static Schedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Schedule deserializedSchedule = new Schedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupType".equals(fieldName)) { + deserializedSchedule.backupType = BackUpType.fromString(reader.getString()); + } else if ("frequency".equals(fieldName)) { + deserializedSchedule.frequency = Frequency.fromString(reader.getString()); + } else if ("runsEvery".equals(fieldName)) { + deserializedSchedule.runsEvery = reader.getNullable(JsonReader::getInt); + } else if ("weekOfMonth".equals(fieldName)) { + deserializedSchedule.weekOfMonth = WeekOfMonth.fromString(reader.getString()); + } else if ("dayOfWeek".equals(fieldName)) { + deserializedSchedule.dayOfWeek = DayOfWeek.fromString(reader.getString()); + } else if ("monthOfYear".equals(fieldName)) { + deserializedSchedule.monthOfYear = MonthOfYear.fromString(reader.getString()); + } else if ("dayOfMonth".equals(fieldName)) { + deserializedSchedule.dayOfMonth = reader.getNullable(JsonReader::getInt); + } else if ("weeklyDays".equals(fieldName)) { + List weeklyDays + = reader.readArray(reader1 -> WeeklyDays.fromString(reader1.getString())); + deserializedSchedule.weeklyDays = weeklyDays; + } else if ("time".equals(fieldName)) { + deserializedSchedule.time = reader.getString(); + } else if ("timeZone".equals(fieldName)) { + deserializedSchedule.timeZone = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSchedule; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StopBackupProtectionGroupRequest.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StopBackupProtectionGroupRequest.java new file mode 100644 index 000000000000..568930ee376a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StopBackupProtectionGroupRequest.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 properties of StopBackupProtectionGroupRequest. + */ +@Fluent +public final class StopBackupProtectionGroupRequest implements JsonSerializable { + /* + * The reason for stopping the backup + */ + private String reason; + + /* + * Any further comments + */ + private String comment; + + /** + * Creates an instance of StopBackupProtectionGroupRequest class. + */ + public StopBackupProtectionGroupRequest() { + } + + /** + * Get the reason property: The reason for stopping the backup. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for stopping the backup. + * + * @param reason the reason value to set. + * @return the StopBackupProtectionGroupRequest object itself. + */ + public StopBackupProtectionGroupRequest withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the comment property: Any further comments. + * + * @return the comment value. + */ + public String comment() { + return this.comment; + } + + /** + * Set the comment property: Any further comments. + * + * @param comment the comment value to set. + * @return the StopBackupProtectionGroupRequest object itself. + */ + public StopBackupProtectionGroupRequest withComment(String comment) { + this.comment = comment; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("reason", this.reason); + jsonWriter.writeStringField("comment", this.comment); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StopBackupProtectionGroupRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StopBackupProtectionGroupRequest 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 StopBackupProtectionGroupRequest. + */ + public static StopBackupProtectionGroupRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StopBackupProtectionGroupRequest deserializedStopBackupProtectionGroupRequest + = new StopBackupProtectionGroupRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reason".equals(fieldName)) { + deserializedStopBackupProtectionGroupRequest.reason = reader.getString(); + } else if ("comment".equals(fieldName)) { + deserializedStopBackupProtectionGroupRequest.comment = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStopBackupProtectionGroupRequest; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storage.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storage.java new file mode 100644 index 000000000000..816a1fc7a807 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storage.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner; + +/** + * An immutable client-side representation of Storage. + */ +public interface Storage { + /** + * 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. + */ + StorageProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner object. + * + * @return the inner object. + */ + StorageInner innerModel(); + + /** + * The entirety of the Storage definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Storage definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Storage definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Storage definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, cloudAccountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @return the next definition stage. + */ + WithCreate withExistingCloudAccount(String resourceGroupName, String cloudAccountName); + } + + /** + * The stage of the Storage 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Storage create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Storage create(Context context); + } + + /** + * The stage of the Storage 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(StorageProperties properties); + } + } + + /** + * Begins update for the Storage resource. + * + * @return the stage of resource update. + */ + Storage.Update update(); + + /** + * The template for Storage update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Storage apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Storage apply(Context context); + } + + /** + * The Storage update stages. + */ + interface UpdateStages { + /** + * The stage of the Storage update 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. + */ + Update withProperties(StorageProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Storage refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Storage refresh(Context context); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageClassType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageClassType.java new file mode 100644 index 000000000000..4a3ee6d095c2 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageClassType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Class of Commvault Storage. + */ +public final class StorageClassType extends ExpandableStringEnum { + /** + * Cold storage class. + */ + public static final StorageClassType COOL = fromString("COLD"); + + /** + * Hot storage class. + */ + public static final StorageClassType HOT = fromString("HOT"); + + /** + * Creates a new instance of StorageClassType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageClassType() { + } + + /** + * Creates or finds a StorageClassType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageClassType. + */ + public static StorageClassType fromString(String name) { + return fromString(name, StorageClassType.class); + } + + /** + * Gets known StorageClassType values. + * + * @return known StorageClassType values. + */ + public static Collection values() { + return values(StorageClassType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StoragePlan.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StoragePlan.java new file mode 100644 index 000000000000..a4d1241020ea --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StoragePlan.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 Commvault Storage Plan. + */ +@Fluent +public final class StoragePlan implements JsonSerializable { + /* + * The name of the Storage resource + */ + private String name; + + /* + * Id of the Storage Pool + */ + private String storagePoolId; + + /* + * Copy Name from Commvault + */ + private String copyName; + + /* + * Precedence of the Storage Plan, 1 is the highest precedence, 2 is the next highest, and so on + */ + private Integer copyPrecedence; + + /* + * Indicates the retention period valid only if the type of retention chosen in CUSTOM + */ + private Integer retentionPeriod; + + /* + * Indicates the retention timeframe valid only if the type of retention chosen in CUSTOM + */ + private RetentionTime retentionTime; + + /* + * Backup Rule Type + */ + private BackupRuleType backupRuleType; + + /* + * Extended Retention Policy + */ + private List extendedRetention; + + /** + * Creates an instance of StoragePlan class. + */ + public StoragePlan() { + } + + /** + * Get the name property: The name of the Storage resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Storage resource. + * + * @param name the name value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the storagePoolId property: Id of the Storage Pool. + * + * @return the storagePoolId value. + */ + public String storagePoolId() { + return this.storagePoolId; + } + + /** + * Set the storagePoolId property: Id of the Storage Pool. + * + * @param storagePoolId the storagePoolId value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withStoragePoolId(String storagePoolId) { + this.storagePoolId = storagePoolId; + return this; + } + + /** + * Get the copyName property: Copy Name from Commvault. + * + * @return the copyName value. + */ + public String copyName() { + return this.copyName; + } + + /** + * Set the copyName property: Copy Name from Commvault. + * + * @param copyName the copyName value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withCopyName(String copyName) { + this.copyName = copyName; + return this; + } + + /** + * Get the copyPrecedence property: Precedence of the Storage Plan, 1 is the highest precedence, 2 is the next + * highest, and so on. + * + * @return the copyPrecedence value. + */ + public Integer copyPrecedence() { + return this.copyPrecedence; + } + + /** + * Set the copyPrecedence property: Precedence of the Storage Plan, 1 is the highest precedence, 2 is the next + * highest, and so on. + * + * @param copyPrecedence the copyPrecedence value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withCopyPrecedence(Integer copyPrecedence) { + this.copyPrecedence = copyPrecedence; + return this; + } + + /** + * Get the retentionPeriod property: Indicates the retention period valid only if the type of retention chosen in + * CUSTOM. + * + * @return the retentionPeriod value. + */ + public Integer retentionPeriod() { + return this.retentionPeriod; + } + + /** + * Set the retentionPeriod property: Indicates the retention period valid only if the type of retention chosen in + * CUSTOM. + * + * @param retentionPeriod the retentionPeriod value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withRetentionPeriod(Integer retentionPeriod) { + this.retentionPeriod = retentionPeriod; + return this; + } + + /** + * Get the retentionTime property: Indicates the retention timeframe valid only if the type of retention chosen in + * CUSTOM. + * + * @return the retentionTime value. + */ + public RetentionTime retentionTime() { + return this.retentionTime; + } + + /** + * Set the retentionTime property: Indicates the retention timeframe valid only if the type of retention chosen in + * CUSTOM. + * + * @param retentionTime the retentionTime value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withRetentionTime(RetentionTime retentionTime) { + this.retentionTime = retentionTime; + return this; + } + + /** + * Get the backupRuleType property: Backup Rule Type. + * + * @return the backupRuleType value. + */ + public BackupRuleType backupRuleType() { + return this.backupRuleType; + } + + /** + * Set the backupRuleType property: Backup Rule Type. + * + * @param backupRuleType the backupRuleType value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withBackupRuleType(BackupRuleType backupRuleType) { + this.backupRuleType = backupRuleType; + return this; + } + + /** + * Get the extendedRetention property: Extended Retention Policy. + * + * @return the extendedRetention value. + */ + public List extendedRetention() { + return this.extendedRetention; + } + + /** + * Set the extendedRetention property: Extended Retention Policy. + * + * @param extendedRetention the extendedRetention value to set. + * @return the StoragePlan object itself. + */ + public StoragePlan withExtendedRetention(List extendedRetention) { + this.extendedRetention = extendedRetention; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("storagePoolId", this.storagePoolId); + jsonWriter.writeStringField("copyName", this.copyName); + jsonWriter.writeNumberField("copyPrecedence", this.copyPrecedence); + jsonWriter.writeNumberField("retentionPeriod", this.retentionPeriod); + jsonWriter.writeStringField("retentionTime", this.retentionTime == null ? null : this.retentionTime.toString()); + jsonWriter.writeStringField("backupRuleType", + this.backupRuleType == null ? null : this.backupRuleType.toString()); + jsonWriter.writeArrayField("extendedRetention", this.extendedRetention, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StoragePlan from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StoragePlan 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 StoragePlan. + */ + public static StoragePlan fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StoragePlan deserializedStoragePlan = new StoragePlan(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedStoragePlan.name = reader.getString(); + } else if ("storagePoolId".equals(fieldName)) { + deserializedStoragePlan.storagePoolId = reader.getString(); + } else if ("copyName".equals(fieldName)) { + deserializedStoragePlan.copyName = reader.getString(); + } else if ("copyPrecedence".equals(fieldName)) { + deserializedStoragePlan.copyPrecedence = reader.getNullable(JsonReader::getInt); + } else if ("retentionPeriod".equals(fieldName)) { + deserializedStoragePlan.retentionPeriod = reader.getNullable(JsonReader::getInt); + } else if ("retentionTime".equals(fieldName)) { + deserializedStoragePlan.retentionTime = RetentionTime.fromString(reader.getString()); + } else if ("backupRuleType".equals(fieldName)) { + deserializedStoragePlan.backupRuleType = BackupRuleType.fromString(reader.getString()); + } else if ("extendedRetention".equals(fieldName)) { + List extendedRetention + = reader.readArray(reader1 -> ExtendedRetentionTime.fromJson(reader1)); + deserializedStoragePlan.extendedRetention = extendedRetention; + } else { + reader.skipChildren(); + } + } + + return deserializedStoragePlan; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageProperties.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageProperties.java new file mode 100644 index 000000000000..efd995f8eeeb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageProperties.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 properties of Commvault Storage. + */ +@Fluent +public final class StorageProperties implements JsonSerializable { + /* + * Location of the Commvault Storage + */ + private String location; + + /* + * The type of Commvault Storage + */ + private StorageType storageType; + + /* + * The vendor of Commvault Storage + */ + private Vendor vendor; + + /* + * The class of Commvault Storage + */ + private StorageClassType classProperty; + + /* + * Provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of StorageProperties class. + */ + public StorageProperties() { + } + + /** + * Get the location property: Location of the Commvault Storage. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the Commvault Storage. + * + * @param location the location value to set. + * @return the StorageProperties object itself. + */ + public StorageProperties withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the storageType property: The type of Commvault Storage. + * + * @return the storageType value. + */ + public StorageType storageType() { + return this.storageType; + } + + /** + * Set the storageType property: The type of Commvault Storage. + * + * @param storageType the storageType value to set. + * @return the StorageProperties object itself. + */ + public StorageProperties withStorageType(StorageType storageType) { + this.storageType = storageType; + return this; + } + + /** + * Get the vendor property: The vendor of Commvault Storage. + * + * @return the vendor value. + */ + public Vendor vendor() { + return this.vendor; + } + + /** + * Set the vendor property: The vendor of Commvault Storage. + * + * @param vendor the vendor value to set. + * @return the StorageProperties object itself. + */ + public StorageProperties withVendor(Vendor vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get the classProperty property: The class of Commvault Storage. + * + * @return the classProperty value. + */ + public StorageClassType classProperty() { + return this.classProperty; + } + + /** + * Set the classProperty property: The class of Commvault Storage. + * + * @param classProperty the classProperty value to set. + * @return the StorageProperties object itself. + */ + public StorageProperties withClassProperty(StorageClassType classProperty) { + this.classProperty = classProperty; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("storageType", this.storageType == null ? null : this.storageType.toString()); + jsonWriter.writeStringField("vendor", this.vendor == null ? null : this.vendor.toString()); + jsonWriter.writeStringField("class", this.classProperty == null ? null : this.classProperty.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageProperties 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 StorageProperties. + */ + public static StorageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageProperties deserializedStorageProperties = new StorageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + deserializedStorageProperties.location = reader.getString(); + } else if ("storageType".equals(fieldName)) { + deserializedStorageProperties.storageType = StorageType.fromString(reader.getString()); + } else if ("vendor".equals(fieldName)) { + deserializedStorageProperties.vendor = Vendor.fromString(reader.getString()); + } else if ("class".equals(fieldName)) { + deserializedStorageProperties.classProperty = StorageClassType.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedStorageProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageProperties; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageType.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageType.java new file mode 100644 index 000000000000..e699c630c91f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageType.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Storage Type of Commvault Storage. + */ +public final class StorageType extends ExpandableStringEnum { + /** + * Air Gap Protect. + */ + public static final StorageType AIR_GAP_PROTECT = fromString("Air_Gap_Protect"); + + /** + * Creates a new instance of StorageType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageType() { + } + + /** + * Creates or finds a StorageType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageType. + */ + public static StorageType fromString(String name) { + return fromString(name, StorageType.class); + } + + /** + * Gets known StorageType values. + * + * @return known StorageType values. + */ + public static Collection values() { + return values(StorageType.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storages.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storages.java new file mode 100644 index 000000000000..dcf6fd4cbc86 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storages.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 Storages. + */ +public interface Storages { + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String cloudAccountName, String storageName, + Context context); + + /** + * Get a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 Storage. + */ + Storage get(String resourceGroupName, String cloudAccountName, String storageName); + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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 delete(String resourceGroupName, String cloudAccountName, String storageName); + + /** + * Delete a Storage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account resource. + * @param storageName Name of the Storage 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. + */ + void delete(String resourceGroupName, String cloudAccountName, String storageName, Context context); + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName); + + /** + * List Storage resources by CloudAccount. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudAccountName Name of the Cloud Account 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 Storage list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCloudAccount(String resourceGroupName, String cloudAccountName, Context context); + + /** + * Get a Storage. + * + * @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 Storage along with {@link Response}. + */ + Storage getById(String id); + + /** + * Get a Storage. + * + * @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 Storage along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Storage. + * + * @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 Storage. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Storage resource. + * + * @param name resource name. + * @return the first stage of the new Storage definition. + */ + Storage.DefinitionStages.Blank define(String name); +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserAssignedIdentity.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..1552d70da011 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity 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 UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserDetails.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserDetails.java new file mode 100644 index 000000000000..4350c952cc97 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserDetails.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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; + +/** + * User details for an organization. + */ +@Fluent +public final class UserDetails implements JsonSerializable { + /* + * First name of the user + */ + private String firstName; + + /* + * Last name of the user + */ + private String lastName; + + /* + * Email address of the user + */ + private String emailAddress; + + /* + * User's principal name + */ + private String upn; + + /* + * User's phone number + */ + private String phoneNumber; + + /** + * Creates an instance of UserDetails class. + */ + public UserDetails() { + } + + /** + * Get the firstName property: First name of the user. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name of the user. + * + * @param firstName the firstName value to set. + * @return the UserDetails object itself. + */ + public UserDetails withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name of the user. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name of the user. + * + * @param lastName the lastName value to set. + * @return the UserDetails object itself. + */ + public UserDetails withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: Email address of the user. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: Email address of the user. + * + * @param emailAddress the emailAddress value to set. + * @return the UserDetails object itself. + */ + public UserDetails withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the upn property: User's principal name. + * + * @return the upn value. + */ + public String upn() { + return this.upn; + } + + /** + * Set the upn property: User's principal name. + * + * @param upn the upn value to set. + * @return the UserDetails object itself. + */ + public UserDetails withUpn(String upn) { + this.upn = upn; + return this; + } + + /** + * Get the phoneNumber property: User's phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: User's phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the UserDetails object itself. + */ + public UserDetails withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("firstName", this.firstName); + jsonWriter.writeStringField("lastName", this.lastName); + jsonWriter.writeStringField("emailAddress", this.emailAddress); + jsonWriter.writeStringField("upn", this.upn); + jsonWriter.writeStringField("phoneNumber", this.phoneNumber); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserDetails 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 UserDetails. + */ + public static UserDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserDetails deserializedUserDetails = new UserDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("firstName".equals(fieldName)) { + deserializedUserDetails.firstName = reader.getString(); + } else if ("lastName".equals(fieldName)) { + deserializedUserDetails.lastName = reader.getString(); + } else if ("emailAddress".equals(fieldName)) { + deserializedUserDetails.emailAddress = reader.getString(); + } else if ("upn".equals(fieldName)) { + deserializedUserDetails.upn = reader.getString(); + } else if ("phoneNumber".equals(fieldName)) { + deserializedUserDetails.phoneNumber = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserDetails; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Vendor.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Vendor.java new file mode 100644 index 000000000000..d511854782e1 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Vendor.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Vendor of Commvault Storage. + */ +public final class Vendor extends ExpandableStringEnum { + /** + * Azure Blob Storage. + */ + public static final Vendor AZURE_BLOB_STORAGE = fromString("Azure_Blob_Storage"); + + /** + * Creates a new instance of Vendor value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Vendor() { + } + + /** + * Creates or finds a Vendor from its string representation. + * + * @param name a name to look for. + * @return the corresponding Vendor. + */ + public static Vendor fromString(String name) { + return fromString(name, Vendor.class); + } + + /** + * Gets known Vendor values. + * + * @return known Vendor values. + */ + public static Collection values() { + return values(Vendor.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmDestinationInfo.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmDestinationInfo.java new file mode 100644 index 000000000000..9236e6cf2a4c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmDestinationInfo.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.commvaultcontentstore.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 VmDestinationInfo. + */ +@Fluent +public final class VmDestinationInfo implements JsonSerializable { + /* + * List of information on VMs + */ + private List vmInfoList; + + /** + * Creates an instance of VmDestinationInfo class. + */ + public VmDestinationInfo() { + } + + /** + * Get the vmInfoList property: List of information on VMs. + * + * @return the vmInfoList value. + */ + public List vmInfoList() { + return this.vmInfoList; + } + + /** + * Set the vmInfoList property: List of information on VMs. + * + * @param vmInfoList the vmInfoList value to set. + * @return the VmDestinationInfo object itself. + */ + public VmDestinationInfo withVmInfoList(List vmInfoList) { + this.vmInfoList = vmInfoList; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("vmInfoList", this.vmInfoList, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VmDestinationInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VmDestinationInfo 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 VmDestinationInfo. + */ + public static VmDestinationInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VmDestinationInfo deserializedVmDestinationInfo = new VmDestinationInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmInfoList".equals(fieldName)) { + List vmInfoList = reader.readArray(reader1 -> VmInfo.fromJson(reader1)); + deserializedVmDestinationInfo.vmInfoList = vmInfoList; + } else { + reader.skipChildren(); + } + } + + return deserializedVmDestinationInfo; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmInfo.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmInfo.java new file mode 100644 index 000000000000..de60f26e697e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmInfo.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 information of a VM. + */ +@Fluent +public final class VmInfo implements JsonSerializable { + /* + * The GUID of VM to be restored. + */ + private String sourceVmGuid; + + /* + * The storage account to be used for restore. + */ + private String storageAccountId; + + /* + * The identifier to check if VM needs to be powered on. + */ + private Boolean powerOnVmAfterRestore; + + /* + * The name of the VM. + */ + private String name; + + /* + * The resource group of the VM. + */ + private String resourceGroup; + + /* + * The region of the VM. + */ + private String region; + + /* + * The network Id of the VM. + */ + private String networkId; + + /* + * The subnet Id of the VM. + */ + private String subnetId; + + /* + * The identifier to check if to attach and swap disk of the VM. + */ + private Boolean attachAndSwapOsDisk; + + /* + * The GUID of target VM used in DISK ATTACH. + */ + private String targetVmGuid; + + /* + * The vmTag of the VM. + */ + private List vmtags; + + /** + * Creates an instance of VmInfo class. + */ + public VmInfo() { + } + + /** + * Get the sourceVmGuid property: The GUID of VM to be restored. + * + * @return the sourceVmGuid value. + */ + public String sourceVmGuid() { + return this.sourceVmGuid; + } + + /** + * Set the sourceVmGuid property: The GUID of VM to be restored. + * + * @param sourceVmGuid the sourceVmGuid value to set. + * @return the VmInfo object itself. + */ + public VmInfo withSourceVmGuid(String sourceVmGuid) { + this.sourceVmGuid = sourceVmGuid; + return this; + } + + /** + * Get the storageAccountId property: The storage account to be used for restore. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: The storage account to be used for restore. + * + * @param storageAccountId the storageAccountId value to set. + * @return the VmInfo object itself. + */ + public VmInfo withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the powerOnVmAfterRestore property: The identifier to check if VM needs to be powered on. + * + * @return the powerOnVmAfterRestore value. + */ + public Boolean powerOnVmAfterRestore() { + return this.powerOnVmAfterRestore; + } + + /** + * Set the powerOnVmAfterRestore property: The identifier to check if VM needs to be powered on. + * + * @param powerOnVmAfterRestore the powerOnVmAfterRestore value to set. + * @return the VmInfo object itself. + */ + public VmInfo withPowerOnVmAfterRestore(Boolean powerOnVmAfterRestore) { + this.powerOnVmAfterRestore = powerOnVmAfterRestore; + return this; + } + + /** + * Get the name property: The name of the VM. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the VM. + * + * @param name the name value to set. + * @return the VmInfo object itself. + */ + public VmInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resourceGroup property: The resource group of the VM. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: The resource group of the VM. + * + * @param resourceGroup the resourceGroup value to set. + * @return the VmInfo object itself. + */ + public VmInfo withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the region property: The region of the VM. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: The region of the VM. + * + * @param region the region value to set. + * @return the VmInfo object itself. + */ + public VmInfo withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the networkId property: The network Id of the VM. + * + * @return the networkId value. + */ + public String networkId() { + return this.networkId; + } + + /** + * Set the networkId property: The network Id of the VM. + * + * @param networkId the networkId value to set. + * @return the VmInfo object itself. + */ + public VmInfo withNetworkId(String networkId) { + this.networkId = networkId; + return this; + } + + /** + * Get the subnetId property: The subnet Id of the VM. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The subnet Id of the VM. + * + * @param subnetId the subnetId value to set. + * @return the VmInfo object itself. + */ + public VmInfo withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the attachAndSwapOsDisk property: The identifier to check if to attach and swap disk of the VM. + * + * @return the attachAndSwapOsDisk value. + */ + public Boolean attachAndSwapOsDisk() { + return this.attachAndSwapOsDisk; + } + + /** + * Set the attachAndSwapOsDisk property: The identifier to check if to attach and swap disk of the VM. + * + * @param attachAndSwapOsDisk the attachAndSwapOsDisk value to set. + * @return the VmInfo object itself. + */ + public VmInfo withAttachAndSwapOsDisk(Boolean attachAndSwapOsDisk) { + this.attachAndSwapOsDisk = attachAndSwapOsDisk; + return this; + } + + /** + * Get the targetVmGuid property: The GUID of target VM used in DISK ATTACH. + * + * @return the targetVmGuid value. + */ + public String targetVmGuid() { + return this.targetVmGuid; + } + + /** + * Set the targetVmGuid property: The GUID of target VM used in DISK ATTACH. + * + * @param targetVmGuid the targetVmGuid value to set. + * @return the VmInfo object itself. + */ + public VmInfo withTargetVmGuid(String targetVmGuid) { + this.targetVmGuid = targetVmGuid; + return this; + } + + /** + * Get the vmtags property: The vmTag of the VM. + * + * @return the vmtags value. + */ + public List vmtags() { + return this.vmtags; + } + + /** + * Set the vmtags property: The vmTag of the VM. + * + * @param vmtags the vmtags value to set. + * @return the VmInfo object itself. + */ + public VmInfo withVmtags(List vmtags) { + this.vmtags = vmtags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceVmGuid", this.sourceVmGuid); + jsonWriter.writeStringField("storageAccountId", this.storageAccountId); + jsonWriter.writeBooleanField("powerOnVmAfterRestore", this.powerOnVmAfterRestore); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("resourceGroup", this.resourceGroup); + jsonWriter.writeStringField("region", this.region); + jsonWriter.writeStringField("networkId", this.networkId); + jsonWriter.writeStringField("subnetId", this.subnetId); + jsonWriter.writeBooleanField("attachAndSwapOsDisk", this.attachAndSwapOsDisk); + jsonWriter.writeStringField("targetVmGuid", this.targetVmGuid); + jsonWriter.writeArrayField("vmtags", this.vmtags, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VmInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VmInfo 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 VmInfo. + */ + public static VmInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VmInfo deserializedVmInfo = new VmInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceVmGuid".equals(fieldName)) { + deserializedVmInfo.sourceVmGuid = reader.getString(); + } else if ("storageAccountId".equals(fieldName)) { + deserializedVmInfo.storageAccountId = reader.getString(); + } else if ("powerOnVmAfterRestore".equals(fieldName)) { + deserializedVmInfo.powerOnVmAfterRestore = reader.getNullable(JsonReader::getBoolean); + } else if ("name".equals(fieldName)) { + deserializedVmInfo.name = reader.getString(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedVmInfo.resourceGroup = reader.getString(); + } else if ("region".equals(fieldName)) { + deserializedVmInfo.region = reader.getString(); + } else if ("networkId".equals(fieldName)) { + deserializedVmInfo.networkId = reader.getString(); + } else if ("subnetId".equals(fieldName)) { + deserializedVmInfo.subnetId = reader.getString(); + } else if ("attachAndSwapOsDisk".equals(fieldName)) { + deserializedVmInfo.attachAndSwapOsDisk = reader.getNullable(JsonReader::getBoolean); + } else if ("targetVmGuid".equals(fieldName)) { + deserializedVmInfo.targetVmGuid = reader.getString(); + } else if ("vmtags".equals(fieldName)) { + List vmtags = reader.readArray(reader1 -> VmTag.fromJson(reader1)); + deserializedVmInfo.vmtags = vmtags; + } else { + reader.skipChildren(); + } + } + + return deserializedVmInfo; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmListItem.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmListItem.java new file mode 100644 index 000000000000..00e9f9539081 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmListItem.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 VM list item for backup. + */ +@Fluent +public final class VmListItem implements JsonSerializable { + /* + * The GUID of the VM to backup + */ + private String vmGuid; + + /** + * Creates an instance of VmListItem class. + */ + public VmListItem() { + } + + /** + * Get the vmGuid property: The GUID of the VM to backup. + * + * @return the vmGuid value. + */ + public String vmGuid() { + return this.vmGuid; + } + + /** + * Set the vmGuid property: The GUID of the VM to backup. + * + * @param vmGuid the vmGuid value to set. + * @return the VmListItem object itself. + */ + public VmListItem withVmGuid(String vmGuid) { + this.vmGuid = vmGuid; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("vmGuid", this.vmGuid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VmListItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VmListItem 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 VmListItem. + */ + public static VmListItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VmListItem deserializedVmListItem = new VmListItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmGuid".equals(fieldName)) { + deserializedVmListItem.vmGuid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVmListItem; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmTag.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmTag.java new file mode 100644 index 000000000000..f7526ed9a110 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmTag.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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 properties of VMTag for Restore Request. + */ +@Fluent +public final class VmTag implements JsonSerializable { + /* + * The name of VM tag. + */ + private String name; + + /* + * The value of VM tag. + */ + private String value; + + /** + * Creates an instance of VmTag class. + */ + public VmTag() { + } + + /** + * Get the name property: The name of VM tag. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of VM tag. + * + * @param name the name value to set. + * @return the VmTag object itself. + */ + public VmTag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of VM tag. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of VM tag. + * + * @param value the value value to set. + * @return the VmTag object itself. + */ + public VmTag withValue(String value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VmTag from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VmTag 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 VmTag. + */ + public static VmTag fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VmTag deserializedVmTag = new VmTag(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVmTag.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedVmTag.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVmTag; + }); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeekOfMonth.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeekOfMonth.java new file mode 100644 index 000000000000..0cf383b197e5 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeekOfMonth.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Week of Month Enum. + */ +public final class WeekOfMonth extends ExpandableStringEnum { + /** + * First Week. + */ + public static final WeekOfMonth FIRST = fromString("FIRST"); + + /** + * Second Week. + */ + public static final WeekOfMonth SECOND = fromString("SECOND"); + + /** + * Third Week. + */ + public static final WeekOfMonth THIRD = fromString("THIRD"); + + /** + * Fourth Week. + */ + public static final WeekOfMonth FOURTH = fromString("FOURTH"); + + /** + * LAST Week. + */ + public static final WeekOfMonth LAST = fromString("LAST"); + + /** + * Creates a new instance of WeekOfMonth value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WeekOfMonth() { + } + + /** + * Creates or finds a WeekOfMonth from its string representation. + * + * @param name a name to look for. + * @return the corresponding WeekOfMonth. + */ + public static WeekOfMonth fromString(String name) { + return fromString(name, WeekOfMonth.class); + } + + /** + * Gets known WeekOfMonth values. + * + * @return known WeekOfMonth values. + */ + public static Collection values() { + return values(WeekOfMonth.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeeklyDays.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeeklyDays.java new file mode 100644 index 000000000000..bc6be96b2c84 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeeklyDays.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.commvaultcontentstore.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * To represent the days of the week in Weekly type. + */ +public final class WeeklyDays extends ExpandableStringEnum { + /** + * First Day of the Week. + */ + public static final WeeklyDays SUNDAY = fromString("SUNDAY"); + + /** + * Second Day of the Week. + */ + public static final WeeklyDays MONDAY = fromString("MONDAY"); + + /** + * Third Day of the Week. + */ + public static final WeeklyDays TUESDAY = fromString("TUESDAY"); + + /** + * Fourth Day of the Week. + */ + public static final WeeklyDays WEDNESDAY = fromString("WEDNESDAY"); + + /** + * Fifth Day of the Week. + */ + public static final WeeklyDays THURSDAY = fromString("THURSDAY"); + + /** + * Sixth Day of the Week. + */ + public static final WeeklyDays FRIDAY = fromString("FRIDAY"); + + /** + * Seventh Day of the Week. + */ + public static final WeeklyDays SATURDAY = fromString("SATURDAY"); + + /** + * Creates a new instance of WeeklyDays value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WeeklyDays() { + } + + /** + * Creates or finds a WeeklyDays from its string representation. + * + * @param name a name to look for. + * @return the corresponding WeeklyDays. + */ + public static WeeklyDays fromString(String name) { + return fromString(name, WeeklyDays.class); + } + + /** + * Gets known WeeklyDays values. + * + * @return known WeeklyDays values. + */ + public static Collection values() { + return values(WeeklyDays.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/package-info.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/package-info.java new file mode 100644 index 000000000000..1a069ad4dbde --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/package-info.java @@ -0,0 +1,8 @@ +// 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 CommvaultContentStore. + */ +package com.azure.resourcemanager.commvaultcontentstore.models; diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/package-info.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/package-info.java new file mode 100644 index 000000000000..6c04c2946eac --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/com/azure/resourcemanager/commvaultcontentstore/package-info.java @@ -0,0 +1,8 @@ +// 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 CommvaultContentStore. + */ +package com.azure.resourcemanager.commvaultcontentstore; diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/module-info.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/java/module-info.java new file mode 100644 index 000000000000..89d5babdadc5 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/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.commvaultcontentstore { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.commvaultcontentstore; + exports com.azure.resourcemanager.commvaultcontentstore.fluent; + exports com.azure.resourcemanager.commvaultcontentstore.fluent.models; + exports com.azure.resourcemanager.commvaultcontentstore.models; + + opens com.azure.resourcemanager.commvaultcontentstore.fluent.models to com.azure.core; + opens com.azure.resourcemanager.commvaultcontentstore.models to com.azure.core; + opens com.azure.resourcemanager.commvaultcontentstore.implementation.models to com.azure.core; +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/azure-resourcemanager-commvaultcontentstore_metadata.json b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/azure-resourcemanager-commvaultcontentstore_metadata.json new file mode 100644 index 000000000000..3eb6014a8355 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/azure-resourcemanager-commvaultcontentstore_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Commvault.ContentStore":"2026-07-03-preview"},"crossLanguagePackageId":"Commvault.ContentStore","crossLanguageVersion":"46b24a5de2d2","crossLanguageDefinitions":{"com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient":"Commvault.ContentStore.CloudAccounts","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.beginCreateOrUpdate":"Commvault.ContentStore.CloudAccounts.createOrUpdate","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.beginDelete":"Commvault.ContentStore.CloudAccounts.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.beginLinkSaaS":"Commvault.ContentStore.CloudAccounts.linkSaaS","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.beginUpdate":"Commvault.ContentStore.CloudAccounts.update","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.createOrUpdate":"Commvault.ContentStore.CloudAccounts.createOrUpdate","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.delete":"Commvault.ContentStore.CloudAccounts.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.getByResourceGroup":"Commvault.ContentStore.CloudAccounts.get","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.getByResourceGroupWithResponse":"Commvault.ContentStore.CloudAccounts.get","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.latestLinkedSaaS":"Commvault.ContentStore.CloudAccounts.latestLinkedSaaS","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.latestLinkedSaaSWithResponse":"Commvault.ContentStore.CloudAccounts.latestLinkedSaaS","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.linkSaaS":"Commvault.ContentStore.CloudAccounts.linkSaaS","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.list":"Commvault.ContentStore.CloudAccounts.listBySubscription","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.listByResourceGroup":"Commvault.ContentStore.CloudAccounts.listByResourceGroup","com.azure.resourcemanager.commvaultcontentstore.fluent.CloudAccountsClient.update":"Commvault.ContentStore.CloudAccounts.update","com.azure.resourcemanager.commvaultcontentstore.fluent.CommvaultContentStoreManagementClient":"Commvault.ContentStore","com.azure.resourcemanager.commvaultcontentstore.fluent.OperationsClient":"Commvault.ContentStore.Operations","com.azure.resourcemanager.commvaultcontentstore.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient":"Commvault.ContentStore.Plans","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.beginCreateOrupdate":"Commvault.ContentStore.Plans.createOrupdate","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.beginDelete":"Commvault.ContentStore.Plans.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.createOrupdate":"Commvault.ContentStore.Plans.createOrupdate","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.delete":"Commvault.ContentStore.Plans.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.get":"Commvault.ContentStore.Plans.get","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.getWithResponse":"Commvault.ContentStore.Plans.get","com.azure.resourcemanager.commvaultcontentstore.fluent.PlansClient.listByCloudAccount":"Commvault.ContentStore.Plans.listByCloudAccount","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient":"Commvault.ContentStore.ProtectedItems","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.get":"Commvault.ContentStore.ProtectedItems.get","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.getRestorePoints":"Commvault.ContentStore.ProtectedItems.getRestorePoints","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.getRestorePointsWithResponse":"Commvault.ContentStore.ProtectedItems.getRestorePoints","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.getWithResponse":"Commvault.ContentStore.ProtectedItems.get","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.listByProtectionGroup":"Commvault.ContentStore.ProtectedItems.listByProtectionGroup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.restore":"Commvault.ContentStore.ProtectedItems.restore","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsClient.restoreWithResponse":"Commvault.ContentStore.ProtectedItems.restore","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsOperationGroupsClient":"Commvault.ContentStore.ProtectedItemsOperationGroup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsOperationGroupsClient.countByProtectionGroups":"Commvault.ContentStore.ProtectedItemsOperationGroup.countByProtectionGroups","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectedItemsOperationGroupsClient.countByProtectionGroupsWithResponse":"Commvault.ContentStore.ProtectedItemsOperationGroup.countByProtectionGroups","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient":"Commvault.ContentStore.ProtectionGroups","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.backup":"Commvault.ContentStore.ProtectionGroups.backup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.backupWithResponse":"Commvault.ContentStore.ProtectionGroups.backup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.beginCreateOrupdate":"Commvault.ContentStore.ProtectionGroups.createOrupdate","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.beginDelete":"Commvault.ContentStore.ProtectionGroups.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.beginStopBackup":"Commvault.ContentStore.ProtectionGroups.stopBackup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.createOrupdate":"Commvault.ContentStore.ProtectionGroups.createOrupdate","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.delete":"Commvault.ContentStore.ProtectionGroups.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.get":"Commvault.ContentStore.ProtectionGroups.get","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.getWithResponse":"Commvault.ContentStore.ProtectionGroups.get","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.listByCloudAccount":"Commvault.ContentStore.ProtectionGroups.listByCloudAccount","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.restore":"Commvault.ContentStore.ProtectionGroups.restore","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.restoreWithResponse":"Commvault.ContentStore.ProtectionGroups.restore","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.resumeBackup":"Commvault.ContentStore.ProtectionGroups.resumeBackup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.resumeBackupWithResponse":"Commvault.ContentStore.ProtectionGroups.resumeBackup","com.azure.resourcemanager.commvaultcontentstore.fluent.ProtectionGroupsClient.stopBackup":"Commvault.ContentStore.ProtectionGroups.stopBackup","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient":"Commvault.ContentStore.RoleMappings","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.createOrUpdate":"Commvault.ContentStore.RoleMappings.createOrUpdate","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.createOrUpdateWithResponse":"Commvault.ContentStore.RoleMappings.createOrUpdate","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.delete":"Commvault.ContentStore.RoleMappings.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.deleteWithResponse":"Commvault.ContentStore.RoleMappings.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.get":"Commvault.ContentStore.RoleMappings.get","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.getWithResponse":"Commvault.ContentStore.RoleMappings.get","com.azure.resourcemanager.commvaultcontentstore.fluent.RoleMappingsClient.list":"Commvault.ContentStore.RoleMappings.list","com.azure.resourcemanager.commvaultcontentstore.fluent.SaaSOperationGroupsClient":"Commvault.ContentStore.SaaSOperationGroup","com.azure.resourcemanager.commvaultcontentstore.fluent.SaaSOperationGroupsClient.activateResource":"Commvault.ContentStore.SaaSOperationGroup.activateResource","com.azure.resourcemanager.commvaultcontentstore.fluent.SaaSOperationGroupsClient.beginActivateResource":"Commvault.ContentStore.SaaSOperationGroup.activateResource","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient":"Commvault.ContentStore.Storages","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.beginCreateOrUpdate":"Commvault.ContentStore.Storages.createOrUpdate","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.beginDelete":"Commvault.ContentStore.Storages.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.createOrUpdate":"Commvault.ContentStore.Storages.createOrUpdate","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.delete":"Commvault.ContentStore.Storages.delete","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.get":"Commvault.ContentStore.Storages.get","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.getWithResponse":"Commvault.ContentStore.Storages.get","com.azure.resourcemanager.commvaultcontentstore.fluent.StoragesClient.listByCloudAccount":"Commvault.ContentStore.Storages.listByCloudAccount","com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner":"Commvault.ContentStore.BackupProtectionGroupResponse","com.azure.resourcemanager.commvaultcontentstore.fluent.models.CloudAccountInner":"Commvault.ContentStore.CloudAccount","com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner":"Commvault.ContentStore.CommvaultPlan","com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner":"Commvault.ContentStore.CountProtectedItemsResponse","com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner":"Commvault.ContentStore.LatestLinkedSaaSResponse","com.azure.resourcemanager.commvaultcontentstore.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner":"Commvault.ContentStore.ProtectedItem","com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner":"Commvault.ContentStore.ProtectionGroup","com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner":"Commvault.ContentStore.RestorePoints","com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner":"Commvault.ContentStore.RestoreProtectionItemResponse","com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner":"Commvault.ContentStore.RoleMapping","com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner":"Commvault.ContentStore.SaaSResourceDetailsResponse","com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner":"Commvault.ContentStore.Storage","com.azure.resourcemanager.commvaultcontentstore.implementation.CommvaultContentStoreManagementClientBuilder":"Commvault.ContentStore","com.azure.resourcemanager.commvaultcontentstore.implementation.models.CloudAccountListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.commvaultcontentstore.implementation.models.CommvaultPlanListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.commvaultcontentstore.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.commvaultcontentstore.implementation.models.ProtectedItemListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.commvaultcontentstore.implementation.models.ProtectionGroupListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.commvaultcontentstore.implementation.models.RoleMappingListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.commvaultcontentstore.implementation.models.StorageListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.commvaultcontentstore.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest":"Commvault.ContentStore.ActivateSaaSParameterRequest","com.azure.resourcemanager.commvaultcontentstore.models.BackUpType":"Commvault.ContentStore.BackUpType","com.azure.resourcemanager.commvaultcontentstore.models.BackupLevel":"Commvault.ContentStore.BackupLevel","com.azure.resourcemanager.commvaultcontentstore.models.BackupOptions":"Commvault.ContentStore.BackupOptions","com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest":"Commvault.ContentStore.BackupProtectionGroupRequest","com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType":"Commvault.ContentStore.BackupRuleType","com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountProperties":"Commvault.ContentStore.CloudAccountProperties","com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdateProperties":"Azure.ResourceManager.Foundations.ResourceUpdateModelProperties","com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest":"Commvault.ContentStore.CountProtectedItemsRequest","com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek":"Commvault.ContentStore.DayOfWeek","com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo":"Commvault.ContentStore.EntityInfo","com.azure.resourcemanager.commvaultcontentstore.models.EntityType":"Commvault.ContentStore.EntityType","com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime":"Commvault.ContentStore.ExtendedRetentionTime","com.azure.resourcemanager.commvaultcontentstore.models.Frequency":"Commvault.ContentStore.Frequency","com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails":"LiftrBase.MarketplaceDetails","com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceSubscriptionStatus":"LiftrBase.MarketplaceSubscriptionStatus","com.azure.resourcemanager.commvaultcontentstore.models.MatchType":"Commvault.ContentStore.MatchType","com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear":"Commvault.ContentStore.MonthOfYear","com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails":"LiftrBase.OfferDetails","com.azure.resourcemanager.commvaultcontentstore.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.commvaultcontentstore.models.Operator":"Commvault.ContentStore.Operator","com.azure.resourcemanager.commvaultcontentstore.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties":"Commvault.ContentStore.PlanProperties","com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItemProperties":"Commvault.ContentStore.ProtectedItemProperties","com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties":"Commvault.ContentStore.ProtectionGroupProperties","com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources":"Commvault.ContentStore.ProtectionGroupResources","com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules":"Commvault.ContentStore.ProtectionGroupResources.matchRules.anonymous","com.azure.resourcemanager.commvaultcontentstore.models.ProtectionStatus":"Commvault.ContentStore.ProtectionStatus","com.azure.resourcemanager.commvaultcontentstore.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest":"Commvault.ContentStore.RestoreProtectionItemRequest","com.azure.resourcemanager.commvaultcontentstore.models.RestoreType":"Commvault.ContentStore.RestoreType","com.azure.resourcemanager.commvaultcontentstore.models.Retention":"Commvault.ContentStore.Retention","com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime":"Commvault.ContentStore.RetentionTime","com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment":"Commvault.ContentStore.RoleAssignment","com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties":"Commvault.ContentStore.RoleMappingProperties","com.azure.resourcemanager.commvaultcontentstore.models.RoleName":"Commvault.ContentStore.RoleName","com.azure.resourcemanager.commvaultcontentstore.models.Rule":"Commvault.ContentStore.Rule","com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty":"Commvault.ContentStore.RuleProperty","com.azure.resourcemanager.commvaultcontentstore.models.SaaSData":"Commvault.ContentStore.SaaSData","com.azure.resourcemanager.commvaultcontentstore.models.Schedule":"Commvault.ContentStore.Schedule","com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest":"Commvault.ContentStore.StopBackupProtectionGroupRequest","com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType":"Commvault.ContentStore.StorageClassType","com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan":"Commvault.ContentStore.StoragePlan","com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties":"Commvault.ContentStore.StorageProperties","com.azure.resourcemanager.commvaultcontentstore.models.StorageType":"Commvault.ContentStore.StorageType","com.azure.resourcemanager.commvaultcontentstore.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity","com.azure.resourcemanager.commvaultcontentstore.models.UserDetails":"LiftrBase.UserDetails","com.azure.resourcemanager.commvaultcontentstore.models.Vendor":"Commvault.ContentStore.Vendor","com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo":"Commvault.ContentStore.VmDestinationInfo","com.azure.resourcemanager.commvaultcontentstore.models.VmInfo":"Commvault.ContentStore.VmInfo","com.azure.resourcemanager.commvaultcontentstore.models.VmListItem":"Commvault.ContentStore.VmListItem","com.azure.resourcemanager.commvaultcontentstore.models.VmTag":"Commvault.ContentStore.VmTag","com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth":"Commvault.ContentStore.WeekOfMonth","com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays":"Commvault.ContentStore.WeeklyDays"},"generatedFiles":["src/main/java/com/azure/resourcemanager/commvaultcontentstore/CommvaultContentStoreManager.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CloudAccountsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/CommvaultContentStoreManagementClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/PlansClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectedItemsOperationGroupsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/ProtectionGroupsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/RoleMappingsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/SaaSOperationGroupsClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/StoragesClient.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/BackupProtectionGroupResponseInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CloudAccountInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CommvaultPlanInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/CountProtectedItemsResponseInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/LatestLinkedSaaSResponseInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectedItemInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/ProtectionGroupInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestorePointsInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RestoreProtectionItemResponseInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/RoleMappingInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/SaaSResourceDetailsResponseInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/StorageInner.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/fluent/package-info.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/BackupProtectionGroupResponseImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CloudAccountsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultContentStoreManagementClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CommvaultPlanImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/CountProtectedItemsResponseImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/LatestLinkedSaaSResponseImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/PlansImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectedItemsOperationGroupsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ProtectionGroupsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestorePointsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RestoreProtectionItemResponseImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/RoleMappingsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSOperationGroupsImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/SaaSResourceDetailsResponseImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StorageImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesClientImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/StoragesImpl.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CloudAccountListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/CommvaultPlanListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectedItemListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/ProtectionGroupListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/RoleMappingListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/models/StorageListResult.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/implementation/package-info.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActionType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ActivateSaaSParameterRequest.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackUpType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupLevel.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupOptions.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupRequest.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupProtectionGroupResponse.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/BackupRuleType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccount.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdate.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccountUpdateProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CloudAccounts.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CommvaultPlan.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsRequest.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/CountProtectedItemsResponse.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/DayOfWeek.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityInfo.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/EntityType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ExtendedRetentionTime.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Frequency.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/LatestLinkedSaaSResponse.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentity.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ManagedServiceIdentityType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceDetails.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MarketplaceSubscriptionStatus.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MatchType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/MonthOfYear.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OfferDetails.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operation.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operations.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Operator.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Origin.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/PlanProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Plans.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItem.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItems.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectedItemsOperationGroups.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroup.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResources.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroupResourcesMatchRules.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionGroups.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ProtectionStatus.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/ResourceProvisioningState.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestorePoints.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemRequest.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreProtectionItemResponse.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RestoreType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Retention.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RetentionTime.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleAssignment.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMapping.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappingProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleMappings.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RoleName.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Rule.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/RuleProperty.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSData.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSOperationGroups.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/SaaSResourceDetailsResponse.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Schedule.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StopBackupProtectionGroupRequest.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storage.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageClassType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StoragePlan.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageProperties.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/StorageType.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Storages.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserAssignedIdentity.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/UserDetails.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/Vendor.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmDestinationInfo.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmInfo.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmListItem.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/VmTag.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeekOfMonth.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/WeeklyDays.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/models/package-info.java","src/main/java/com/azure/resourcemanager/commvaultcontentstore/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commvaultcontentstore/proxy-config.json b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commvaultcontentstore/proxy-config.json new file mode 100644 index 000000000000..850d3089e193 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commvaultcontentstore/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.commvaultcontentstore.implementation.CloudAccountsClientImpl$CloudAccountsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.PlansClientImpl$PlansService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.ProtectedItemsClientImpl$ProtectedItemsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.ProtectedItemsOperationGroupsClientImpl$ProtectedItemsOperationGroupsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.ProtectionGroupsClientImpl$ProtectionGroupsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.RoleMappingsClientImpl$RoleMappingsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.SaaSOperationGroupsClientImpl$SaaSOperationGroupsService"],["com.azure.resourcemanager.commvaultcontentstore.implementation.StoragesClientImpl$StoragesService"]] \ No newline at end of file diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commvaultcontentstore/reflect-config.json b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commvaultcontentstore/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commvaultcontentstore/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/azure-resourcemanager-commvaultcontentstore.properties b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/azure-resourcemanager-commvaultcontentstore.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/main/resources/azure-resourcemanager-commvaultcontentstore.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsCreateOrUpdateSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..063e53b86446 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsCreateOrUpdateSamples.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudAccounts CreateOrUpdate. + */ +public final class CloudAccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_CreateOrUpdate_MinimumSet - CCA create with create-only role bootstrap fields omitted. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void cloudAccountsCreateOrUpdateMinimumSetCCACreateWithCreateOnlyRoleBootstrapFieldsOmitted( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .define("sample-cloudAccountName") + .withRegion("eastus") + .withExistingResourceGroup("rgcommvault") + .withTags(mapOf()) + .withProperties(new CloudAccountProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("tblwyuznrazgchhfczgtlaifwamndt") + .withOfferDetails(new OfferDetails().withPublisherId("npghpdbgiohslbbeihxdwucejb") + .withOfferId("recofyvhkddgkuvducosjstenmy") + .withPlanId("pqoyqqavjh") + .withPlanName("hwcltkdvndwfmmnthzwvocujri") + .withTermUnit("wzrzqyfzrpqhy") + .withTermId("avpgkctrkwdmudsz"))) + .withUser(new UserDetails().withFirstName("John") + .withLastName("Doe") + .withEmailAddress("john.doe@contoso.com") + .withUpn("john.doe@contoso.com") + .withPhoneNumber("1234567890"))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .create(); + } + + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void cloudAccountsCreateOrUpdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .define("sample-cloudAccountName") + .withRegion("sxzmmidsfbba") + .withExistingResourceGroup("rgcommvault") + .withTags(mapOf()) + .withProperties(new CloudAccountProperties().withMarketplace(new MarketplaceDetails() + .withSubscriptionId("tblwyuznrazgchhfczgtlaifwamndt") + .withSaasResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-commvault/providers/Microsoft.SaaS/resources/commvault-saas") + .withOfferDetails(new OfferDetails().withPublisherId("npghpdbgiohslbbeihxdwucejb") + .withOfferId("recofyvhkddgkuvducosjstenmy") + .withPlanId("pqoyqqavjh") + .withPlanName("hwcltkdvndwfmmnthzwvocujri") + .withTermUnit("wzrzqyfzrpqhy") + .withTermId("avpgkctrkwdmudsz"))) + .withUser(new UserDetails().withFirstName("mpiviyooskqkyjqqpgnkderu") + .withLastName("ppkcvfjylquebr") + .withEmailAddress("user@example.com") + .withUpn("frlpmyk") + .withPhoneNumber("mpunfyfckyzpqxotsmclzk")) + .withBackupAdminOnCcaCreate(new EntityInfo().withId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withDisplayName("Tenant Admins") + .withEntityType(EntityType.GROUP)) + .withMultiPersonAuthorizationOnCcaCreate(new EntityInfo().withId("11111111-2222-3333-4444-555555555555") + .withDisplayName("John Smith") + .withEntityType(EntityType.USER))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsDeleteSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsDeleteSamples.java new file mode 100644 index 000000000000..48d8b0ba52b9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsDeleteSamples.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.commvaultcontentstore.generated; + +/** + * Samples for CloudAccounts Delete. + */ +public final class CloudAccountsDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().delete("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsGetByResourceGroupSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..35f2acf98f04 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsGetByResourceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +/** + * Samples for CloudAccounts GetByResourceGroup. + */ +public final class CloudAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .getByResourceGroupWithResponse("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLatestLinkedSaaSSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLatestLinkedSaaSSamples.java new file mode 100644 index 000000000000..30bc2e4248bd --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLatestLinkedSaaSSamples.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.commvaultcontentstore.generated; + +/** + * Samples for CloudAccounts LatestLinkedSaaS. + */ +public final class CloudAccountsLatestLinkedSaaSSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_LatestLinkedSaaS_MaximumSet_Gen.json + */ + /** + * Sample code: Returns the latest SaaS linked to the cloud account. - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void returnsTheLatestSaaSLinkedToTheCloudAccountGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .latestLinkedSaaSWithResponse("rg-commvault", "contoso-cloud-account", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLinkSaaSSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLinkSaaSSamples.java new file mode 100644 index 000000000000..76fbd5cfd0b4 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLinkSaaSSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; + +/** + * Samples for CloudAccounts LinkSaaS. + */ +public final class CloudAccountsLinkSaaSSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_LinkSaaS_MaximumSet_Gen.json + */ + /** + * Sample code: Links a new SaaS to the organization of the underlying monitor. - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + linksANewSaaSToTheOrganizationOfTheUnderlyingMonitorGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts() + .linkSaaS("rg-commvault", "contoso-cloud-account", new SaaSData().withSaaSResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-commvault/providers/Microsoft.SaaS/resources/commvault-saas"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsListByResourceGroupSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsListByResourceGroupSamples.java new file mode 100644 index 000000000000..cca67684075e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsListByResourceGroupSamples.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.commvaultcontentstore.generated; + +/** + * Samples for CloudAccounts ListByResourceGroup. + */ +public final class CloudAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListByResourceGroup_MinimumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().listByResourceGroup("rgcommvault", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListByResourceGroup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().listByResourceGroup("rgcommvault", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsListSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsListSamples.java new file mode 100644 index 000000000000..3f35c38705d9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsListSamples.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.commvaultcontentstore.generated; + +/** + * Samples for CloudAccounts List. + */ +public final class CloudAccountsListSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListBySubscription_MinimumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListBySubscription_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_ListBySubscription_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.cloudAccounts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsUpdateSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsUpdateSamples.java new file mode 100644 index 000000000000..762d0e573469 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsUpdateSamples.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.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccount; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdateProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudAccounts Update. + */ +public final class CloudAccountsUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/CloudAccounts_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CloudAccounts_Update_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + cloudAccountsUpdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + CloudAccount resource = manager.cloudAccounts() + .getByResourceGroupWithResponse("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .withProperties(new CloudAccountUpdateProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("bojdg") + .withOfferDetails(new OfferDetails().withPublisherId("loowntsnvoynhzto") + .withOfferId("ysmwsuakhwvkosz") + .withPlanId("iskbkfpr") + .withPlanName("pmmlirssfdvdmywddvtl") + .withTermUnit("wbeqzbtvq") + .withTermId("qoebjvpjc"))) + .withUser(new UserDetails().withFirstName("dudsiomjk") + .withLastName("szqupklkgojwozjo") + .withEmailAddress("user@example.com") + .withUpn("wiwwe") + .withPhoneNumber("ebszyfnuyzk"))) + .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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationsListSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationsListSamples.java new file mode 100644 index 000000000000..8407d8220533 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationsListSamples.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.commvaultcontentstore.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansCreateOrupdateSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansCreateOrupdateSamples.java new file mode 100644 index 000000000000..131b4351bb95 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansCreateOrupdateSamples.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.Retention; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Schedule; +import com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import java.util.Arrays; + +/** + * Samples for Plans CreateOrupdate. + */ +public final class PlansCreateOrupdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_CreateOrupdate_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_CreateOrupdate_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + plansCreateOrupdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans() + .define("sample-planName") + .withExistingCloudAccount("rgcommvault", "sample-cloudAccountName") + .withProperties( + new PlanProperties().withLocation("igaxdfxtzecvxlzgdxzuq") + .withStoragePlans(Arrays.asList( + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("tllxzjnfcdb") + .withStoragePoolId("ccxxkrvgfhdzqq") + .withCopyName("lzhgzjlilwqgrvxsajtxwbrs") + .withCopyPrecedence(14) + .withRetentionPeriod(21) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(10) + .withBackupRuleType(BackupRuleType.ALL_JOBS))))) + .withSchedules(Arrays.asList( + new Schedule().withBackupType(BackUpType.INCREMENTAL) + .withFrequency(Frequency.DAILY) + .withRunsEvery(17) + .withWeekOfMonth(WeekOfMonth.FIRST) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMonthOfYear(MonthOfYear.JANUARY) + .withDayOfMonth(25) + .withWeeklyDays(Arrays.asList(WeeklyDays.SUNDAY)) + .withTime("xrkimwcrnltnhiotzdguqjddo") + .withTimeZone("tvcpczczysengkxzqfy"), + new Schedule().withBackupType(BackUpType.INCREMENTAL) + .withFrequency(Frequency.DAILY) + .withRunsEvery(17) + .withWeekOfMonth(WeekOfMonth.FIRST) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMonthOfYear(MonthOfYear.JANUARY) + .withDayOfMonth(25) + .withWeeklyDays(Arrays.asList(WeeklyDays.SUNDAY)) + .withTime("xrkimwcrnltnhiotzdguqjddo") + .withTimeZone("tvcpczczysengkxzqfy"))) + .withRetention(new Retention().withNumberOfSnapshots(1))) + .create(); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansDeleteSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansDeleteSamples.java new file mode 100644 index 000000000000..6115c613c9c7 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansDeleteSamples.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.commvaultcontentstore.generated; + +/** + * Samples for Plans Delete. + */ +public final class PlansDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void plansDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans() + .delete("rgcommvault", "sample-cloudAccountName", "sample-planName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansGetSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansGetSamples.java new file mode 100644 index 000000000000..2c3ae820890b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +/** + * Samples for Plans Get. + */ +public final class PlansGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - generated + * by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void plansGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-planName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansListByCloudAccountSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansListByCloudAccountSamples.java new file mode 100644 index 000000000000..e58ec050d961 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansListByCloudAccountSamples.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.commvaultcontentstore.generated; + +/** + * Samples for Plans ListByCloudAccount. + */ +public final class PlansListByCloudAccountSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Plans_ListByCloudAccount_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_ListByCloudAccount_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + plansListByCloudAccountMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.plans().listByCloudAccount("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetRestorePointsSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetRestorePointsSamples.java new file mode 100644 index 000000000000..2d71e9c89ba1 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetRestorePointsSamples.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.commvaultcontentstore.generated; + +/** + * Samples for ProtectedItems GetRestorePoints. + */ +public final class ProtectedItemsGetRestorePointsSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_GetRestorePoints_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_GetRestorePoints_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsGetRestorePointsMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .getRestorePointsWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + "sample-protectedItemName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetSamples.java new file mode 100644 index 000000000000..8d68307af9c2 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetSamples.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.commvaultcontentstore.generated; + +/** + * Samples for ProtectedItems Get. + */ +public final class ProtectedItemsGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_Get_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + "sample-protectedItemName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsListByProtectionGroupSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsListByProtectionGroupSamples.java new file mode 100644 index 000000000000..9e0ff7fb9a6c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsListByProtectionGroupSamples.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.commvaultcontentstore.generated; + +/** + * Samples for ProtectedItems ListByProtectionGroup. + */ +public final class ProtectedItemsListByProtectionGroupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_ListByProtectionGroup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_ListByProtectionGroup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsListByProtectionGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .listByProtectionGroup("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsOperationGroupCountByProtectionGroupsSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsOperationGroupCountByProtectionGroupsSamples.java new file mode 100644 index 000000000000..0667bfbd3150 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsOperationGroupCountByProtectionGroupsSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; +import java.util.Arrays; + +/** + * Samples for ProtectedItemsOperationGroup CountByProtectionGroups. + */ +public final class ProtectedItemsOperationGroupCountByProtectionGroupsSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItemsOperationGroup_CountByProtectionGroups_MinimumSet_Gen.json + */ + /** + * Sample code: ProtectedItemsOperationGroup_CountByProtectionGroups_MinimumSet. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void protectedItemsOperationGroupCountByProtectionGroupsMinimumSet( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItemsOperationGroups() + .countByProtectionGroupsWithResponse(new CountProtectedItemsRequest().withResourceIds(Arrays.asList( + "/subscriptions/65D4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName", + "/subscriptions/A7E4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault2/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName2")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItemsOperationGroup_CountByProtectionGroups_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItemsOperationGroup_CountByProtectionGroups_MaximumSet. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void protectedItemsOperationGroupCountByProtectionGroupsMaximumSet( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItemsOperationGroups() + .countByProtectionGroupsWithResponse(new CountProtectedItemsRequest().withResourceIds(Arrays.asList( + "/subscriptions/65D4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName", + "/subscriptions/A7E4E6D7-7063-4C4B-BAC5-13C45474009E/resourceGroups/rgcommvault2/providers/Commvault.ContentStore/cloudAccounts/sample-cloudAccountName2")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsRestoreSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsRestoreSamples.java new file mode 100644 index 000000000000..17362988a9ab --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsRestoreSamples.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.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; + +/** + * Samples for ProtectedItems Restore. + */ +public final class ProtectedItemsRestoreSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectedItems_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectedItems_Restore_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectedItemsRestoreMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectedItems() + .restoreWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + "sample-protectedItemName", + new RestoreProtectionItemRequest().withInPlaceRestore(true) + .withRestoreType(RestoreType.NONE) + .withToTime("kgueys") + .withVmDestinationInfo(new VmDestinationInfo().withVmInfoList( + Arrays.asList(new VmInfo().withSourceVmGuid("40000000-aaaa-4bbb-8ccc-000000000000") + .withStorageAccountId("pldvo") + .withPowerOnVmAfterRestore(true) + .withName("ctmwbnzhxqdhshl") + .withResourceGroup("pdfpesq") + .withRegion("ywwecvwsosvatgmulaxfnja") + .withNetworkId("amtetghiqnbjuiurekikacvymxjcv") + .withSubnetId("klskhhutusnzycgxaq") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("40000000-aaaa-4bbb-8ccc-000000000001") + .withVmtags(Arrays.asList(new VmTag().withName("dzabcqlzgqphznrpzhrqbsszgdzjrh") + .withValue("zjtpbngipinqlwajjrf")))))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsBackupSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsBackupSamples.java new file mode 100644 index 000000000000..c04c8cffa2d6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsBackupSamples.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.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.BackupLevel; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupOptions; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.VmListItem; +import java.util.Arrays; + +/** + * Samples for ProtectionGroups Backup. + */ +public final class ProtectionGroupsBackupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Backup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Backup_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsBackupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .backupWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + new BackupProtectionGroupRequest() + .withVmList(Arrays.asList(new VmListItem().withVmGuid("40000000-aaaa-4bbb-8ccc-000000000000"))) + .withBackupOptions(new BackupOptions().withBackupLevel(BackupLevel.FULL) + .withJobDescription("Ad-hoc backup job") + .withBackupCopyImmediately(true) + .withRunSnapShotBackup(true) + .withNotifyUserOnJobCompletion(true)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsCreateOrupdateSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsCreateOrupdateSamples.java new file mode 100644 index 000000000000..e6076b407d28 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsCreateOrupdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.util.Arrays; + +/** + * Samples for ProtectionGroups CreateOrupdate. + */ +public final class ProtectionGroupsCreateOrupdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_CreateOrupdate_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_CreateOrupdate_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsCreateOrupdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .define("sample-protectionGroupName") + .withExistingCloudAccount("rgcommvault", "sample-cloudAccountName") + .withProperties(new ProtectionGroupProperties().withPlan("ibcuuodwnnvgyhy") + .withResources(new ProtectionGroupResources().withManual(Arrays.asList("uljwtwhm")) + .withMatchRules(new ProtectionGroupResourcesMatchRules() + .withRules(Arrays.asList(new Rule().withProperty(RuleProperty.RESOURCE_GROUP) + .withOperator(Operator.CONTAINS) + .withValue("dgkmghsgmrbaatklarukbx"))) + .withMatchType(MatchType.ALL)))) + .create(); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsDeleteSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsDeleteSamples.java new file mode 100644 index 000000000000..82fb6d05ac3a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsDeleteSamples.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.commvaultcontentstore.generated; + +/** + * Samples for ProtectionGroups Delete. + */ +public final class ProtectionGroupsDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .delete("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsGetSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsGetSamples.java new file mode 100644 index 000000000000..aa30aa4cfa63 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsGetSamples.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.commvaultcontentstore.generated; + +/** + * Samples for ProtectionGroups Get. + */ +public final class ProtectionGroupsGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Get_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsListByCloudAccountSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsListByCloudAccountSamples.java new file mode 100644 index 000000000000..d475badab3db --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsListByCloudAccountSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +/** + * Samples for ProtectionGroups ListByCloudAccount. + */ +public final class ProtectionGroupsListByCloudAccountSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_ListByCloudAccount_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_ListByCloudAccount_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsListByCloudAccountMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .listByCloudAccount("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsRestoreSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsRestoreSamples.java new file mode 100644 index 000000000000..38cf4a8bb6ff --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsRestoreSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; + +/** + * Samples for ProtectionGroups Restore. + */ +public final class ProtectionGroupsRestoreSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_Restore_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsRestoreMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .restoreWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + new RestoreProtectionItemRequest().withInPlaceRestore(true) + .withRestoreType(RestoreType.NONE) + .withToTime("kgueys") + .withVmDestinationInfo(new VmDestinationInfo().withVmInfoList( + Arrays.asList(new VmInfo().withSourceVmGuid("40000000-aaaa-4bbb-8ccc-000000000000") + .withStorageAccountId("pldvo") + .withPowerOnVmAfterRestore(true) + .withName("ctmwbnzhxqdhshl") + .withResourceGroup("pdfpesq") + .withRegion("ywwecvwsosvatgmulaxfnja") + .withNetworkId("amtetghiqnbjuiurekikacvymxjcv") + .withSubnetId("klskhhutusnzycgxaq") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("40000000-aaaa-4bbb-8ccc-000000000001") + .withVmtags(Arrays.asList(new VmTag().withName("dzabcqlzgqphznrpzhrqbsszgdzjrh") + .withValue("zjtpbngipinqlwajjrf")))))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsResumeBackupSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsResumeBackupSamples.java new file mode 100644 index 000000000000..38e71f312733 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsResumeBackupSamples.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.commvaultcontentstore.generated; + +/** + * Samples for ProtectionGroups ResumeBackup. + */ +public final class ProtectionGroupsResumeBackupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_ResumeBackup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_ResumeBackup_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsResumeBackupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .resumeBackupWithResponse("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsStopBackupSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsStopBackupSamples.java new file mode 100644 index 000000000000..1e7914f85a2c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsStopBackupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; + +/** + * Samples for ProtectionGroups StopBackup. + */ +public final class ProtectionGroupsStopBackupSamples { + /* + * x-ms-original-file: 2026-07-03-preview/ProtectionGroups_StopBackup_MaximumSet_Gen.json + */ + /** + * Sample code: ProtectionGroups_StopBackup_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + protectionGroupsStopBackupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.protectionGroups() + .stopBackup("rgcommvault", "sample-cloudAccountName", "sample-protectionGroupName", + new StopBackupProtectionGroupRequest().withReason("auzneewhs").withComment("ipaalpltffowhwzoxqmcc"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsCreateOrUpdateSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..9784bb831483 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsCreateOrUpdateSamples.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import java.util.Arrays; + +/** + * Samples for RoleMappings CreateOrUpdate. + */ +public final class RoleMappingsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: RoleMappings_CreateOrUpdate_MinimumSet - Single BackupAdmin role only. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsCreateOrUpdateMinimumSetSingleBackupAdminRoleOnly( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings() + .createOrUpdateWithResponse("rgcommvault", "myCloudAccount", + new RoleMappingInner().withProperties(new RoleMappingProperties() + .withRoles(Arrays.asList(new RoleAssignment().withRoleName(RoleName.BACKUP_ADMIN) + .withEntities(Arrays.asList(new EntityInfo().withId("a1b2c3d4-e5f6-7890-abcd-ef1234567890") + .withDisplayName("Tenant Admins") + .withEntityType(EntityType.GROUP)))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsCreateOrUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings() + .createOrUpdateWithResponse("rgcommvault", "myCloudAccount", + new RoleMappingInner() + .withProperties( + new RoleMappingProperties() + .withRoles( + Arrays + .asList( + new RoleAssignment().withRoleName(RoleName.BACKUP_ADMIN) + .withEntities( + Arrays + .asList( + new EntityInfo().withId("a1b2c3d4-e5f6-7890-abcd-ef1234567890") + .withDisplayName("Backup Admins Group") + .withEntityType(EntityType.GROUP))), + new RoleAssignment().withRoleName(RoleName.BACKUP_OPERATOR) + .withEntities(Arrays.asList( + new EntityInfo().withId("11111111-2222-3333-4444-555555555555") + .withDisplayName("Commvault-Operators") + .withEntityType(EntityType.GROUP), + new EntityInfo() + .withId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withDisplayName("John Smith") + .withEntityType(EntityType.USER))), + new RoleAssignment().withRoleName(RoleName.BACKUP_USER) + .withEntities(Arrays + .asList(new EntityInfo().withId("22222222-3333-4444-5555-666666666666") + .withDisplayName("Jane Doe") + .withEntityType(EntityType.USER)))))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsDeleteSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsDeleteSamples.java new file mode 100644 index 000000000000..2c1890f52451 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsDeleteSamples.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.commvaultcontentstore.generated; + +/** + * Samples for RoleMappings Delete. + */ +public final class RoleMappingsDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_Delete_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsDeleteMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings() + .deleteByResourceGroupWithResponse("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsGetSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsGetSamples.java new file mode 100644 index 000000000000..8d6c165c1a84 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsGetSamples.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.commvaultcontentstore.generated; + +/** + * Samples for RoleMappings Get. + */ +public final class RoleMappingsGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_Get_MinimumSet_Gen.json + */ + /** + * Sample code: RoleMappings_Get_MinimumSet - Get role mappings with single role. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsGetMinimumSetGetRoleMappingsWithSingleRole( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().getWithResponse("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_Get_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().getWithResponse("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsListSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsListSamples.java new file mode 100644 index 000000000000..6e04d380cbf2 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsListSamples.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.commvaultcontentstore.generated; + +/** + * Samples for RoleMappings List. + */ +public final class RoleMappingsListSamples { + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_List_MaximumSet_Gen.json + */ + /** + * Sample code: RoleMappings_List. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + roleMappingsList(com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().list("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/RoleMappings_List_MinimumSet_Gen.json + */ + /** + * Sample code: RoleMappings_List_MinimumSet - List role mappings with single role. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void roleMappingsListMinimumSetListRoleMappingsWithSingleRole( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.roleMappings().list("rgcommvault", "myCloudAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSOperationGroupActivateResourceSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSOperationGroupActivateResourceSamples.java new file mode 100644 index 000000000000..5046f78343af --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSOperationGroupActivateResourceSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; + +/** + * Samples for SaaSOperationGroup ActivateResource. + */ +public final class SaaSOperationGroupActivateResourceSamples { + /* + * x-ms-original-file: 2026-07-03-preview/SaaSOperationGroup_ActivateResource_MaximumSet_Gen.json + */ + /** + * Sample code: SaaSOperationGroup_ActivateResource_MaximumSet - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void saaSOperationGroupActivateResourceMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.saaSOperationGroups() + .activateResource(new ActivateSaaSParameterRequest().withSaaSGuid("55555555-6666-7777-8888-999999999999"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-07-03-preview/SaaSOperationGroup_ActivateResource_MinimumSet_Gen.json + */ + /** + * Sample code: SaaSOperationGroup_ActivateResource_MaximumSet - generated by [MaximumSet] rule - generated by + * [MinimumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void saaSOperationGroupActivateResourceMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.saaSOperationGroups() + .activateResource(new ActivateSaaSParameterRequest().withSaaSGuid("55555555-6666-7777-8888-999999999999"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesCreateOrUpdateSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..18df30845242 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesCreateOrUpdateSamples.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.commvaultcontentstore.generated; + +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; + +/** + * Samples for Storages CreateOrUpdate. + */ +public final class StoragesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule + * - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + storagesCreateOrUpdateMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .define("sample-storageName") + .withExistingCloudAccount("rgcommvault", "sample-cloudAccountName") + .withProperties(new StorageProperties().withLocation("idxxvyqhyxvahalfmkbjxklfbimouxnasnxdmaydqv") + .withStorageType(StorageType.AIR_GAP_PROTECT) + .withVendor(Vendor.AZURE_BLOB_STORAGE) + .withClassProperty(StorageClassType.COOL)) + .create(); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesDeleteSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesDeleteSamples.java new file mode 100644 index 000000000000..466cafd9120a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +/** + * Samples for Storages Delete. + */ +public final class StoragesDeleteSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_Delete_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + storagesDeleteMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .delete("rgcommvault", "sample-cloudAccountName", "sample-storageName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesGetSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesGetSamples.java new file mode 100644 index 000000000000..6093c6327aa4 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +/** + * Samples for Storages Get. + */ +public final class StoragesGetSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_Get_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] rule - + * generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void storagesGetMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .getWithResponse("rgcommvault", "sample-cloudAccountName", "sample-storageName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesListByCloudAccountSamples.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesListByCloudAccountSamples.java new file mode 100644 index 000000000000..8bb6c8b8e65a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/samples/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesListByCloudAccountSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +/** + * Samples for Storages ListByCloudAccount. + */ +public final class StoragesListByCloudAccountSamples { + /* + * x-ms-original-file: 2026-07-03-preview/Storages_ListByCloudAccount_MaximumSet_Gen.json + */ + /** + * Sample code: Storages_ListByCloudAccount_MaximumSet - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommvaultContentStoreManager. + */ + public static void + storagesListByCloudAccountMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.commvaultcontentstore.CommvaultContentStoreManager manager) { + manager.storages() + .listByCloudAccount("rgcommvault", "sample-cloudAccountName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ActivateSaaSParameterRequestTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ActivateSaaSParameterRequestTests.java new file mode 100644 index 000000000000..ed191fc5fc63 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ActivateSaaSParameterRequestTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; +import org.junit.jupiter.api.Assertions; + +public final class ActivateSaaSParameterRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActivateSaaSParameterRequest model + = BinaryData.fromString("{\"saaSGuid\":\"z\"}").toObject(ActivateSaaSParameterRequest.class); + Assertions.assertEquals("z", model.saaSGuid()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActivateSaaSParameterRequest model = new ActivateSaaSParameterRequest().withSaaSGuid("z"); + model = BinaryData.fromObject(model).toObject(ActivateSaaSParameterRequest.class); + Assertions.assertEquals("z", model.saaSGuid()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupOptionsTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupOptionsTests.java new file mode 100644 index 000000000000..3bdfdd05d469 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupOptionsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupLevel; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupOptions; +import org.junit.jupiter.api.Assertions; + +public final class BackupOptionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackupOptions model = BinaryData.fromString( + "{\"backupLevel\":\"SYNTHETIC_FULL\",\"jobDescription\":\"bqdxbx\",\"backupCopyImmediately\":true,\"runSnapShotBackup\":true,\"notifyUserOnJobCompletion\":true}") + .toObject(BackupOptions.class); + Assertions.assertEquals(BackupLevel.SYNTHETIC_FULL, model.backupLevel()); + Assertions.assertEquals("bqdxbx", model.jobDescription()); + Assertions.assertTrue(model.backupCopyImmediately()); + Assertions.assertTrue(model.runSnapShotBackup()); + Assertions.assertTrue(model.notifyUserOnJobCompletion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BackupOptions model = new BackupOptions().withBackupLevel(BackupLevel.SYNTHETIC_FULL) + .withJobDescription("bqdxbx") + .withBackupCopyImmediately(true) + .withRunSnapShotBackup(true) + .withNotifyUserOnJobCompletion(true); + model = BinaryData.fromObject(model).toObject(BackupOptions.class); + Assertions.assertEquals(BackupLevel.SYNTHETIC_FULL, model.backupLevel()); + Assertions.assertEquals("bqdxbx", model.jobDescription()); + Assertions.assertTrue(model.backupCopyImmediately()); + Assertions.assertTrue(model.runSnapShotBackup()); + Assertions.assertTrue(model.notifyUserOnJobCompletion()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupProtectionGroupRequestTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupProtectionGroupRequestTests.java new file mode 100644 index 000000000000..fe5d49794a09 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupProtectionGroupRequestTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupLevel; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupOptions; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.VmListItem; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class BackupProtectionGroupRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackupProtectionGroupRequest model = BinaryData.fromString( + "{\"vmList\":[{\"vmGuid\":\"nkww\"},{\"vmGuid\":\"pp\"},{\"vmGuid\":\"flcxoga\"},{\"vmGuid\":\"konzmnsik\"}],\"backupOptions\":{\"backupLevel\":\"FULL\",\"jobDescription\":\"qzeqqkdltfzxm\",\"backupCopyImmediately\":true,\"runSnapShotBackup\":false,\"notifyUserOnJobCompletion\":false}}") + .toObject(BackupProtectionGroupRequest.class); + Assertions.assertEquals("nkww", model.vmList().get(0).vmGuid()); + Assertions.assertEquals(BackupLevel.FULL, model.backupOptions().backupLevel()); + Assertions.assertEquals("qzeqqkdltfzxm", model.backupOptions().jobDescription()); + Assertions.assertTrue(model.backupOptions().backupCopyImmediately()); + Assertions.assertFalse(model.backupOptions().runSnapShotBackup()); + Assertions.assertFalse(model.backupOptions().notifyUserOnJobCompletion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BackupProtectionGroupRequest model = new BackupProtectionGroupRequest() + .withVmList(Arrays.asList(new VmListItem().withVmGuid("nkww"), new VmListItem().withVmGuid("pp"), + new VmListItem().withVmGuid("flcxoga"), new VmListItem().withVmGuid("konzmnsik"))) + .withBackupOptions(new BackupOptions().withBackupLevel(BackupLevel.FULL) + .withJobDescription("qzeqqkdltfzxm") + .withBackupCopyImmediately(true) + .withRunSnapShotBackup(false) + .withNotifyUserOnJobCompletion(false)); + model = BinaryData.fromObject(model).toObject(BackupProtectionGroupRequest.class); + Assertions.assertEquals("nkww", model.vmList().get(0).vmGuid()); + Assertions.assertEquals(BackupLevel.FULL, model.backupOptions().backupLevel()); + Assertions.assertEquals("qzeqqkdltfzxm", model.backupOptions().jobDescription()); + Assertions.assertTrue(model.backupOptions().backupCopyImmediately()); + Assertions.assertFalse(model.backupOptions().runSnapShotBackup()); + Assertions.assertFalse(model.backupOptions().notifyUserOnJobCompletion()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupProtectionGroupResponseInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupProtectionGroupResponseInnerTests.java new file mode 100644 index 000000000000..28f8259c231f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/BackupProtectionGroupResponseInnerTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.BackupProtectionGroupResponseInner; + +public final class BackupProtectionGroupResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackupProtectionGroupResponseInner model = BinaryData + .fromString( + "{\"taskId\":1836889631,\"jobIds\":[\"qxn\",\"lkzgxhuriplbp\",\"dxunkbebxmubyyn\",\"wlrbqtkoievseo\"]}") + .toObject(BackupProtectionGroupResponseInner.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountUpdatePropertiesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountUpdatePropertiesTests.java new file mode 100644 index 000000000000..23d849509bb9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountUpdatePropertiesTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdateProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import org.junit.jupiter.api.Assertions; + +public final class CloudAccountUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CloudAccountUpdateProperties model = BinaryData.fromString( + "{\"marketplace\":{\"subscriptionId\":\"xhcr\",\"subscriptionStatus\":\"Subscribed\",\"saasResourceId\":\"jtckwhdso\",\"offerDetails\":{\"publisherId\":\"fiyipjxsqwpgrj\",\"offerId\":\"znorcj\",\"planId\":\"snb\",\"planName\":\"qabnmoc\",\"termUnit\":\"ysh\",\"termId\":\"zafb\"}},\"user\":{\"firstName\":\"gpbtoqcjmklj\",\"lastName\":\"bqidtqaj\",\"emailAddress\":\"ulpkudjkrl\",\"upn\":\"bzhfepgzgqexz\",\"phoneNumber\":\"c\"}}") + .toObject(CloudAccountUpdateProperties.class); + Assertions.assertEquals("xhcr", model.marketplace().subscriptionId()); + Assertions.assertEquals("jtckwhdso", model.marketplace().saasResourceId()); + Assertions.assertEquals("fiyipjxsqwpgrj", model.marketplace().offerDetails().publisherId()); + Assertions.assertEquals("znorcj", model.marketplace().offerDetails().offerId()); + Assertions.assertEquals("snb", model.marketplace().offerDetails().planId()); + Assertions.assertEquals("qabnmoc", model.marketplace().offerDetails().planName()); + Assertions.assertEquals("ysh", model.marketplace().offerDetails().termUnit()); + Assertions.assertEquals("zafb", model.marketplace().offerDetails().termId()); + Assertions.assertEquals("gpbtoqcjmklj", model.user().firstName()); + Assertions.assertEquals("bqidtqaj", model.user().lastName()); + Assertions.assertEquals("ulpkudjkrl", model.user().emailAddress()); + Assertions.assertEquals("bzhfepgzgqexz", model.user().upn()); + Assertions.assertEquals("c", model.user().phoneNumber()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CloudAccountUpdateProperties model = new CloudAccountUpdateProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("xhcr") + .withSaasResourceId("jtckwhdso") + .withOfferDetails(new OfferDetails().withPublisherId("fiyipjxsqwpgrj") + .withOfferId("znorcj") + .withPlanId("snb") + .withPlanName("qabnmoc") + .withTermUnit("ysh") + .withTermId("zafb"))) + .withUser(new UserDetails().withFirstName("gpbtoqcjmklj") + .withLastName("bqidtqaj") + .withEmailAddress("ulpkudjkrl") + .withUpn("bzhfepgzgqexz") + .withPhoneNumber("c")); + model = BinaryData.fromObject(model).toObject(CloudAccountUpdateProperties.class); + Assertions.assertEquals("xhcr", model.marketplace().subscriptionId()); + Assertions.assertEquals("jtckwhdso", model.marketplace().saasResourceId()); + Assertions.assertEquals("fiyipjxsqwpgrj", model.marketplace().offerDetails().publisherId()); + Assertions.assertEquals("znorcj", model.marketplace().offerDetails().offerId()); + Assertions.assertEquals("snb", model.marketplace().offerDetails().planId()); + Assertions.assertEquals("qabnmoc", model.marketplace().offerDetails().planName()); + Assertions.assertEquals("ysh", model.marketplace().offerDetails().termUnit()); + Assertions.assertEquals("zafb", model.marketplace().offerDetails().termId()); + Assertions.assertEquals("gpbtoqcjmklj", model.user().firstName()); + Assertions.assertEquals("bqidtqaj", model.user().lastName()); + Assertions.assertEquals("ulpkudjkrl", model.user().emailAddress()); + Assertions.assertEquals("bzhfepgzgqexz", model.user().upn()); + Assertions.assertEquals("c", model.user().phoneNumber()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountUpdateTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountUpdateTests.java new file mode 100644 index 000000000000..e28935ae90e1 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountUpdateTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdate; +import com.azure.resourcemanager.commvaultcontentstore.models.CloudAccountUpdateProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.UserAssignedIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CloudAccountUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CloudAccountUpdate model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"ktapspwgcuertu\",\"tenantId\":\"dosvqwhbmdgbbjf\",\"type\":\"None\",\"userAssignedIdentities\":{\"gbquxigj\":{\"principalId\":\"mbe\",\"clientId\":\"pbhtqqrolfpfpsa\"},\"uvfqawrlyxwj\":{\"principalId\":\"gzjaoyfhrtxilne\",\"clientId\":\"ujysvle\"},\"qguhmuo\":{\"principalId\":\"prbnwbxgjvtbv\",\"clientId\":\"sszdnru\"}}},\"tags\":{\"gazxuf\":\"prwzwbnguitnwui\"},\"properties\":{\"marketplace\":{\"subscriptionId\":\"kyfi\",\"subscriptionStatus\":\"Subscribed\",\"saasResourceId\":\"dfvzwdzuhty\",\"offerDetails\":{\"publisherId\":\"wisdkft\",\"offerId\":\"wxmnteiwao\",\"planId\":\"km\",\"planName\":\"c\",\"termUnit\":\"xdcu\",\"termId\":\"fsrpymzidnse\"}},\"user\":{\"firstName\":\"tbzsgfyccs\",\"lastName\":\"wmdwzjeiachboo\",\"emailAddress\":\"lnrosfqp\",\"upn\":\"ehzzvypyqrim\",\"phoneNumber\":\"npvswjdkirso\"}}}") + .toObject(CloudAccountUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("prwzwbnguitnwui", model.tags().get("gazxuf")); + Assertions.assertEquals("kyfi", model.properties().marketplace().subscriptionId()); + Assertions.assertEquals("dfvzwdzuhty", model.properties().marketplace().saasResourceId()); + Assertions.assertEquals("wisdkft", model.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("wxmnteiwao", model.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("km", model.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("c", model.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("xdcu", model.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("fsrpymzidnse", model.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("tbzsgfyccs", model.properties().user().firstName()); + Assertions.assertEquals("wmdwzjeiachboo", model.properties().user().lastName()); + Assertions.assertEquals("lnrosfqp", model.properties().user().emailAddress()); + Assertions.assertEquals("ehzzvypyqrim", model.properties().user().upn()); + Assertions.assertEquals("npvswjdkirso", model.properties().user().phoneNumber()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CloudAccountUpdate model = new CloudAccountUpdate() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("gbquxigj", new UserAssignedIdentity(), "uvfqawrlyxwj", + new UserAssignedIdentity(), "qguhmuo", new UserAssignedIdentity()))) + .withTags(mapOf("gazxuf", "prwzwbnguitnwui")) + .withProperties(new CloudAccountUpdateProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("kyfi") + .withSaasResourceId("dfvzwdzuhty") + .withOfferDetails(new OfferDetails().withPublisherId("wisdkft") + .withOfferId("wxmnteiwao") + .withPlanId("km") + .withPlanName("c") + .withTermUnit("xdcu") + .withTermId("fsrpymzidnse"))) + .withUser(new UserDetails().withFirstName("tbzsgfyccs") + .withLastName("wmdwzjeiachboo") + .withEmailAddress("lnrosfqp") + .withUpn("ehzzvypyqrim") + .withPhoneNumber("npvswjdkirso"))); + model = BinaryData.fromObject(model).toObject(CloudAccountUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("prwzwbnguitnwui", model.tags().get("gazxuf")); + Assertions.assertEquals("kyfi", model.properties().marketplace().subscriptionId()); + Assertions.assertEquals("dfvzwdzuhty", model.properties().marketplace().saasResourceId()); + Assertions.assertEquals("wisdkft", model.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("wxmnteiwao", model.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("km", model.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("c", model.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("xdcu", model.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("fsrpymzidnse", model.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("tbzsgfyccs", model.properties().user().firstName()); + Assertions.assertEquals("wmdwzjeiachboo", model.properties().user().lastName()); + Assertions.assertEquals("lnrosfqp", model.properties().user().emailAddress()); + Assertions.assertEquals("ehzzvypyqrim", model.properties().user().upn()); + Assertions.assertEquals("npvswjdkirso", model.properties().user().phoneNumber()); + } + + // 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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLatestLinkedSaaSWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLatestLinkedSaaSWithResponseMockTests.java new file mode 100644 index 000000000000..21c8936c4a88 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CloudAccountsLatestLinkedSaaSWithResponseMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.LatestLinkedSaaSResponse; +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 CloudAccountsLatestLinkedSaaSWithResponseMockTests { + @Test + public void testLatestLinkedSaaSWithResponse() throws Exception { + String responseStr = "{\"saaSResourceId\":\"oftrmaequia\",\"isHiddenSaaS\":false}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + LatestLinkedSaaSResponse response = manager.cloudAccounts() + .latestLinkedSaaSWithResponse("uhhziuiefozbhdm", "mlmz", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("oftrmaequia", response.saaSResourceId()); + Assertions.assertFalse(response.isHiddenSaaS()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CommvaultPlanInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CommvaultPlanInnerTests.java new file mode 100644 index 000000000000..4ae00a7a813c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CommvaultPlanInnerTests.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CommvaultPlanInner; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.Retention; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Schedule; +import com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CommvaultPlanInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommvaultPlanInner model = BinaryData.fromString( + "{\"properties\":{\"location\":\"gtzxdpn\",\"storagePlans\":[{\"name\":\"qqwx\",\"storagePoolId\":\"feallnwsu\",\"copyName\":\"snjampmng\",\"copyPrecedence\":1097907718,\"retentionPeriod\":1460212605,\"retentionTime\":\"yearly\",\"backupRuleType\":\"YEARLY_FULLS\",\"extendedRetention\":[{\"retentionTime\":\"monthly\",\"retentionPeriod\":804356907,\"backupRuleType\":\"WEEKLY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":1140257037,\"backupRuleType\":\"QUARTERLY_FULLS\"},{\"retentionTime\":\"yearly\",\"retentionPeriod\":396203358,\"backupRuleType\":\"MONTHLY_FULLS\"},{\"retentionTime\":\"yearly\",\"retentionPeriod\":1902616098,\"backupRuleType\":\"YEARLY_FULLS\"}]},{\"name\":\"f\",\"storagePoolId\":\"keyyi\",\"copyName\":\"jbdlwtgrhpdjpju\",\"copyPrecedence\":1786348929,\"retentionPeriod\":2023668162,\"retentionTime\":\"monthly\",\"backupRuleType\":\"QUARTERLY_FULLS\",\"extendedRetention\":[{\"retentionTime\":\"yearly\",\"retentionPeriod\":1664958649,\"backupRuleType\":\"ALL_JOBS\"}]}],\"schedules\":[{\"backupType\":\"FULL\",\"frequency\":\"minutes\",\"runsEvery\":497531730,\"weekOfMonth\":\"FOURTH\",\"dayOfWeek\":\"MONDAY\",\"monthOfYear\":\"JUNE\",\"dayOfMonth\":621270176,\"weeklyDays\":[\"TUESDAY\"],\"time\":\"otwmcyn\",\"timeZone\":\"lbjnpgacftadehx\"},{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":632380018,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"WEEKEND_DAYS\",\"monthOfYear\":\"MAY\",\"dayOfMonth\":1230833613,\"weeklyDays\":[\"SUNDAY\",\"FRIDAY\",\"MONDAY\"],\"time\":\"bavo\",\"timeZone\":\"zdmohctbqvu\"},{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":1492638603,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"WEEKDAY\",\"monthOfYear\":\"MAY\",\"dayOfMonth\":884625398,\"weeklyDays\":[\"SUNDAY\",\"MONDAY\",\"SATURDAY\"],\"time\":\"glhslazj\",\"timeZone\":\"ggd\"}],\"retention\":{\"numberOfSnapshots\":1916189356},\"provisioningState\":\"Canceled\"},\"id\":\"uofqwe\",\"name\":\"kh\",\"type\":\"enevfyexfwhybci\"}") + .toObject(CommvaultPlanInner.class); + Assertions.assertEquals("gtzxdpn", model.properties().location()); + Assertions.assertEquals("qqwx", model.properties().storagePlans().get(0).name()); + Assertions.assertEquals("feallnwsu", model.properties().storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("snjampmng", model.properties().storagePlans().get(0).copyName()); + Assertions.assertEquals(1097907718, model.properties().storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1460212605, model.properties().storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.YEARLY, model.properties().storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.YEARLY_FULLS, model.properties().storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(RetentionTime.MONTHLY, + model.properties().storagePlans().get(0).extendedRetention().get(0).retentionTime()); + Assertions.assertEquals(804356907, + model.properties().storagePlans().get(0).extendedRetention().get(0).retentionPeriod()); + Assertions.assertEquals(BackupRuleType.WEEKLY_FULLS, + model.properties().storagePlans().get(0).extendedRetention().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.FULL, model.properties().schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.MINUTES, model.properties().schedules().get(0).frequency()); + Assertions.assertEquals(497531730, model.properties().schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.FOURTH, model.properties().schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.MONDAY, model.properties().schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.JUNE, model.properties().schedules().get(0).monthOfYear()); + Assertions.assertEquals(621270176, model.properties().schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.TUESDAY, model.properties().schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("otwmcyn", model.properties().schedules().get(0).time()); + Assertions.assertEquals("lbjnpgacftadehx", model.properties().schedules().get(0).timeZone()); + Assertions.assertEquals(1916189356, model.properties().retention().numberOfSnapshots()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommvaultPlanInner model + = new CommvaultPlanInner() + .withProperties( + new PlanProperties().withLocation("gtzxdpn") + .withStoragePlans( + Arrays.asList( + new StoragePlan().withName("qqwx") + .withStoragePoolId("feallnwsu") + .withCopyName("snjampmng") + .withCopyPrecedence(1097907718) + .withRetentionPeriod(1460212605) + .withRetentionTime(RetentionTime.YEARLY) + .withBackupRuleType(BackupRuleType.YEARLY_FULLS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(804356907) + .withBackupRuleType(BackupRuleType.WEEKLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(1140257037) + .withBackupRuleType(BackupRuleType.QUARTERLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(396203358) + .withBackupRuleType(BackupRuleType.MONTHLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1902616098) + .withBackupRuleType(BackupRuleType.YEARLY_FULLS))), + new StoragePlan().withName("f") + .withStoragePoolId("keyyi") + .withCopyName("jbdlwtgrhpdjpju") + .withCopyPrecedence(1786348929) + .withRetentionPeriod(2023668162) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.QUARTERLY_FULLS) + .withExtendedRetention(Arrays + .asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1664958649) + .withBackupRuleType(BackupRuleType.ALL_JOBS))))) + .withSchedules(Arrays.asList( + new Schedule().withBackupType(BackUpType.FULL) + .withFrequency(Frequency.MINUTES) + .withRunsEvery(497531730) + .withWeekOfMonth(WeekOfMonth.FOURTH) + .withDayOfWeek(DayOfWeek.MONDAY) + .withMonthOfYear(MonthOfYear.JUNE) + .withDayOfMonth(621270176) + .withWeeklyDays(Arrays.asList(WeeklyDays.TUESDAY)) + .withTime("otwmcyn") + .withTimeZone("lbjnpgacftadehx"), + new Schedule().withBackupType(BackUpType.BOTH) + .withFrequency(Frequency.MONTHLY) + .withRunsEvery(632380018) + .withWeekOfMonth(WeekOfMonth.THIRD) + .withDayOfWeek(DayOfWeek.WEEKEND_DAYS) + .withMonthOfYear(MonthOfYear.MAY) + .withDayOfMonth(1230833613) + .withWeeklyDays(Arrays.asList(WeeklyDays.SUNDAY, WeeklyDays.FRIDAY, WeeklyDays.MONDAY)) + .withTime("bavo") + .withTimeZone("zdmohctbqvu"), + new Schedule().withBackupType(BackUpType.BOTH) + .withFrequency(Frequency.MONTHLY) + .withRunsEvery(1492638603) + .withWeekOfMonth(WeekOfMonth.THIRD) + .withDayOfWeek(DayOfWeek.WEEKDAY) + .withMonthOfYear(MonthOfYear.MAY) + .withDayOfMonth(884625398) + .withWeeklyDays( + Arrays.asList(WeeklyDays.SUNDAY, WeeklyDays.MONDAY, WeeklyDays.SATURDAY)) + .withTime("glhslazj") + .withTimeZone("ggd"))) + .withRetention(new Retention().withNumberOfSnapshots(1916189356))); + model = BinaryData.fromObject(model).toObject(CommvaultPlanInner.class); + Assertions.assertEquals("gtzxdpn", model.properties().location()); + Assertions.assertEquals("qqwx", model.properties().storagePlans().get(0).name()); + Assertions.assertEquals("feallnwsu", model.properties().storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("snjampmng", model.properties().storagePlans().get(0).copyName()); + Assertions.assertEquals(1097907718, model.properties().storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1460212605, model.properties().storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.YEARLY, model.properties().storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.YEARLY_FULLS, model.properties().storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(RetentionTime.MONTHLY, + model.properties().storagePlans().get(0).extendedRetention().get(0).retentionTime()); + Assertions.assertEquals(804356907, + model.properties().storagePlans().get(0).extendedRetention().get(0).retentionPeriod()); + Assertions.assertEquals(BackupRuleType.WEEKLY_FULLS, + model.properties().storagePlans().get(0).extendedRetention().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.FULL, model.properties().schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.MINUTES, model.properties().schedules().get(0).frequency()); + Assertions.assertEquals(497531730, model.properties().schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.FOURTH, model.properties().schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.MONDAY, model.properties().schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.JUNE, model.properties().schedules().get(0).monthOfYear()); + Assertions.assertEquals(621270176, model.properties().schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.TUESDAY, model.properties().schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("otwmcyn", model.properties().schedules().get(0).time()); + Assertions.assertEquals("lbjnpgacftadehx", model.properties().schedules().get(0).timeZone()); + Assertions.assertEquals(1916189356, model.properties().retention().numberOfSnapshots()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CommvaultPlanListResultTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CommvaultPlanListResultTests.java new file mode 100644 index 000000000000..0b416a78fe74 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CommvaultPlanListResultTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.CommvaultPlanListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import org.junit.jupiter.api.Assertions; + +public final class CommvaultPlanListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommvaultPlanListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"location\":\"burvjxxjnspy\",\"storagePlans\":[{\"name\":\"tko\",\"storagePoolId\":\"kouknvudwtiu\",\"copyName\":\"ldngkpoci\",\"copyPrecedence\":198508752,\"retentionPeriod\":1866473569,\"retentionTime\":\"yearly\",\"backupRuleType\":\"HALF_YEARLY_FULLS\",\"extendedRetention\":[{}]},{\"name\":\"jnpiucgyg\",\"storagePoolId\":\"qzntypm\",\"copyName\":\"p\",\"copyPrecedence\":173387394,\"retentionPeriod\":71732550,\"retentionTime\":\"monthly\",\"backupRuleType\":\"WEEKLY_FULLS\",\"extendedRetention\":[{},{},{},{}]},{\"name\":\"dnfyhxdeoejzicwi\",\"storagePoolId\":\"jttgzf\",\"copyName\":\"shcbkhajdeyeamdp\",\"copyPrecedence\":203407725,\"retentionPeriod\":2125402633,\"retentionTime\":\"monthly\",\"backupRuleType\":\"HOURLY_FULLS\",\"extendedRetention\":[{},{},{}]}],\"schedules\":[{\"backupType\":\"INCREMENTAL\",\"frequency\":\"yearly\",\"runsEvery\":390798331,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"SATURDAY\",\"monthOfYear\":\"OCTOBER\",\"dayOfMonth\":248274393,\"weeklyDays\":[\"FRIDAY\",\"SATURDAY\",\"TUESDAY\",\"WEDNESDAY\"],\"time\":\"jeputtmrywn\",\"timeZone\":\"oqftiyqzrnkcq\"},{\"backupType\":\"INCREMENTAL\",\"frequency\":\"weekly\",\"runsEvery\":1062459417,\"weekOfMonth\":\"SECOND\",\"dayOfWeek\":\"TUESDAY\",\"monthOfYear\":\"SEPTEMBER\",\"dayOfMonth\":601015315,\"weeklyDays\":[\"SATURDAY\",\"WEDNESDAY\"],\"time\":\"lryav\",\"timeZone\":\"heun\"},{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":1040307072,\"weekOfMonth\":\"FOURTH\",\"dayOfWeek\":\"SATURDAY\",\"monthOfYear\":\"FEBRUARY\",\"dayOfMonth\":702146280,\"weeklyDays\":[\"MONDAY\",\"MONDAY\",\"MONDAY\"],\"time\":\"xuconu\",\"timeZone\":\"zf\"}],\"retention\":{\"numberOfSnapshots\":1773736624},\"provisioningState\":\"Succeeded\"},\"id\":\"rmjmwvvjektc\",\"name\":\"senhwlrs\",\"type\":\"frzpwvlqdqgb\"},{\"properties\":{\"location\":\"ylihkaetckt\",\"storagePlans\":[{\"name\":\"civfsnkymuctq\",\"storagePoolId\":\"fbebrjcxer\",\"copyName\":\"wutttxfvjrbi\",\"copyPrecedence\":1236632858,\"retentionPeriod\":684290279,\"retentionTime\":\"monthly\",\"backupRuleType\":\"WEEKLY_FULLS\",\"extendedRetention\":[{},{}]},{\"name\":\"fnljky\",\"storagePoolId\":\"j\",\"copyName\":\"ujqgidok\",\"copyPrecedence\":792619615,\"retentionPeriod\":1108075171,\"retentionTime\":\"monthly\",\"backupRuleType\":\"DAILY_FULLS\",\"extendedRetention\":[{},{},{}]},{\"name\":\"tbgsncghkj\",\"storagePoolId\":\"zz\",\"copyName\":\"ijhtxf\",\"copyPrecedence\":749525568,\"retentionPeriod\":615517918,\"retentionTime\":\"monthly\",\"backupRuleType\":\"ALL_JOBS\",\"extendedRetention\":[{},{}]}],\"schedules\":[{\"backupType\":\"FULL\",\"frequency\":\"monthly\",\"runsEvery\":1534633799,\"weekOfMonth\":\"FIRST\",\"dayOfWeek\":\"WEEKDAY\",\"monthOfYear\":\"JUNE\",\"dayOfMonth\":898595537,\"weeklyDays\":[\"SUNDAY\",\"THURSDAY\",\"SATURDAY\"],\"time\":\"gr\",\"timeZone\":\"flz\"},{\"backupType\":\"INCREMENTAL\",\"frequency\":\"weekly\",\"runsEvery\":599393599,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"TUESDAY\",\"monthOfYear\":\"JULY\",\"dayOfMonth\":1593715454,\"weeklyDays\":[\"WEDNESDAY\",\"SATURDAY\",\"FRIDAY\",\"FRIDAY\"],\"time\":\"brpyydhi\",\"timeZone\":\"uqqkpik\"},{\"backupType\":\"FULL\",\"frequency\":\"monthly\",\"runsEvery\":348182971,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"THURSDAY\",\"monthOfYear\":\"APRIL\",\"dayOfMonth\":855671205,\"weeklyDays\":[\"THURSDAY\",\"SATURDAY\",\"SATURDAY\"],\"time\":\"ebf\",\"timeZone\":\"arbu\"}],\"retention\":{\"numberOfSnapshots\":1856462665},\"provisioningState\":\"Canceled\"},\"id\":\"zzmhjrunmpxttd\",\"name\":\"hrbnlankxmyskpbh\",\"type\":\"nbtkcxywnytnr\"},{\"properties\":{\"location\":\"nlqidybyxczf\",\"storagePlans\":[{\"name\":\"haaxdbabphl\",\"storagePoolId\":\"qlfktsths\",\"copyName\":\"ocmnyyazttbtwwrq\",\"copyPrecedence\":1833989004,\"retentionPeriod\":1640743814,\"retentionTime\":\"monthly\",\"backupRuleType\":\"QUARTERLY_FULLS\",\"extendedRetention\":[{},{},{}]},{\"name\":\"exzfeyue\",\"storagePoolId\":\"ibx\",\"copyName\":\"wbhqwal\",\"copyPrecedence\":1122495677,\"retentionPeriod\":1436163401,\"retentionTime\":\"yearly\",\"backupRuleType\":\"WEEKLY_FULLS\",\"extendedRetention\":[{},{},{},{}]},{\"name\":\"zjancuxr\",\"storagePoolId\":\"wbavxbniwdj\",\"copyName\":\"zt\",\"copyPrecedence\":593552862,\"retentionPeriod\":806707414,\"retentionTime\":\"yearly\",\"backupRuleType\":\"ALL_FULLS\",\"extendedRetention\":[{},{},{}]}],\"schedules\":[{\"backupType\":\"BOTH\",\"frequency\":\"minutes\",\"runsEvery\":1070853035,\"weekOfMonth\":\"FOURTH\",\"dayOfWeek\":\"DAY\",\"monthOfYear\":\"AUGUST\",\"dayOfMonth\":650781860,\"weeklyDays\":[\"WEDNESDAY\",\"TUESDAY\"],\"time\":\"yqiklbbovplwzb\",\"timeZone\":\"gy\"},{\"backupType\":\"INCREMENTAL\",\"frequency\":\"weekly\",\"runsEvery\":230150141,\"weekOfMonth\":\"SECOND\",\"dayOfWeek\":\"FRIDAY\",\"monthOfYear\":\"NOVEMBER\",\"dayOfMonth\":406049393,\"weeklyDays\":[\"SATURDAY\",\"WEDNESDAY\",\"THURSDAY\"],\"time\":\"mg\",\"timeZone\":\"nkjzkdeslpvlop\"},{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":1278093245,\"weekOfMonth\":\"LAST\",\"dayOfWeek\":\"SUNDAY\",\"monthOfYear\":\"NOVEMBER\",\"dayOfMonth\":1170549879,\"weeklyDays\":[\"FRIDAY\",\"SUNDAY\",\"MONDAY\"],\"time\":\"umnyqu\",\"timeZone\":\"deoj\"}],\"retention\":{\"numberOfSnapshots\":949740199},\"provisioningState\":\"Canceled\"},\"id\":\"mtxpsiebtfh\",\"name\":\"pesapskrdqmhjj\",\"type\":\"htldwk\"}],\"nextLink\":\"xuutkncwscwsv\"}") + .toObject(CommvaultPlanListResult.class); + Assertions.assertEquals("burvjxxjnspy", model.value().get(0).properties().location()); + Assertions.assertEquals("tko", model.value().get(0).properties().storagePlans().get(0).name()); + Assertions.assertEquals("kouknvudwtiu", + model.value().get(0).properties().storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("ldngkpoci", model.value().get(0).properties().storagePlans().get(0).copyName()); + Assertions.assertEquals(198508752, model.value().get(0).properties().storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1866473569, model.value().get(0).properties().storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.YEARLY, + model.value().get(0).properties().storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.HALF_YEARLY_FULLS, + model.value().get(0).properties().storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.INCREMENTAL, + model.value().get(0).properties().schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.YEARLY, model.value().get(0).properties().schedules().get(0).frequency()); + Assertions.assertEquals(390798331, model.value().get(0).properties().schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.THIRD, model.value().get(0).properties().schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.SATURDAY, model.value().get(0).properties().schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.OCTOBER, + model.value().get(0).properties().schedules().get(0).monthOfYear()); + Assertions.assertEquals(248274393, model.value().get(0).properties().schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.FRIDAY, + model.value().get(0).properties().schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("jeputtmrywn", model.value().get(0).properties().schedules().get(0).time()); + Assertions.assertEquals("oqftiyqzrnkcq", model.value().get(0).properties().schedules().get(0).timeZone()); + Assertions.assertEquals(1773736624, model.value().get(0).properties().retention().numberOfSnapshots()); + Assertions.assertEquals("xuutkncwscwsv", model.nextLink()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CountProtectedItemsRequestTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CountProtectedItemsRequestTests.java new file mode 100644 index 000000000000..4a97cce51d76 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CountProtectedItemsRequestTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CountProtectedItemsRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CountProtectedItemsRequest model + = BinaryData.fromString("{\"resourceIds\":[\"jmquxvypomgk\"]}").toObject(CountProtectedItemsRequest.class); + Assertions.assertEquals("jmquxvypomgk", model.resourceIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CountProtectedItemsRequest model + = new CountProtectedItemsRequest().withResourceIds(Arrays.asList("jmquxvypomgk")); + model = BinaryData.fromObject(model).toObject(CountProtectedItemsRequest.class); + Assertions.assertEquals("jmquxvypomgk", model.resourceIds().get(0)); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CountProtectedItemsResponseInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CountProtectedItemsResponseInnerTests.java new file mode 100644 index 000000000000..d5fa3345424a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/CountProtectedItemsResponseInnerTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.CountProtectedItemsResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class CountProtectedItemsResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CountProtectedItemsResponseInner model + = BinaryData.fromString("{\"count\":\"pkwhojvpa\"}").toObject(CountProtectedItemsResponseInner.class); + Assertions.assertEquals("pkwhojvpa", model.count()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/EntityInfoTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/EntityInfoTests.java new file mode 100644 index 000000000000..21235eae59ee --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/EntityInfoTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import org.junit.jupiter.api.Assertions; + +public final class EntityInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EntityInfo model + = BinaryData.fromString("{\"id\":\"ugjzzdatqxhocdge\",\"displayName\":\"lgphu\",\"entityType\":\"Group\"}") + .toObject(EntityInfo.class); + Assertions.assertEquals("ugjzzdatqxhocdge", model.id()); + Assertions.assertEquals("lgphu", model.displayName()); + Assertions.assertEquals(EntityType.GROUP, model.entityType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EntityInfo model + = new EntityInfo().withId("ugjzzdatqxhocdge").withDisplayName("lgphu").withEntityType(EntityType.GROUP); + model = BinaryData.fromObject(model).toObject(EntityInfo.class); + Assertions.assertEquals("ugjzzdatqxhocdge", model.id()); + Assertions.assertEquals("lgphu", model.displayName()); + Assertions.assertEquals(EntityType.GROUP, model.entityType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ExtendedRetentionTimeTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ExtendedRetentionTimeTests.java new file mode 100644 index 000000000000..b8deb8f018c2 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ExtendedRetentionTimeTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import org.junit.jupiter.api.Assertions; + +public final class ExtendedRetentionTimeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExtendedRetentionTime model = BinaryData + .fromString( + "{\"retentionTime\":\"monthly\",\"retentionPeriod\":1915206631,\"backupRuleType\":\"WEEKLY_FULLS\"}") + .toObject(ExtendedRetentionTime.class); + Assertions.assertEquals(RetentionTime.MONTHLY, model.retentionTime()); + Assertions.assertEquals(1915206631, model.retentionPeriod()); + Assertions.assertEquals(BackupRuleType.WEEKLY_FULLS, model.backupRuleType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExtendedRetentionTime model = new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(1915206631) + .withBackupRuleType(BackupRuleType.WEEKLY_FULLS); + model = BinaryData.fromObject(model).toObject(ExtendedRetentionTime.class); + Assertions.assertEquals(RetentionTime.MONTHLY, model.retentionTime()); + Assertions.assertEquals(1915206631, model.retentionPeriod()); + Assertions.assertEquals(BackupRuleType.WEEKLY_FULLS, model.backupRuleType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/LatestLinkedSaaSResponseInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/LatestLinkedSaaSResponseInnerTests.java new file mode 100644 index 000000000000..f7277ee97789 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/LatestLinkedSaaSResponseInnerTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.LatestLinkedSaaSResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class LatestLinkedSaaSResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LatestLinkedSaaSResponseInner model = BinaryData.fromString("{\"saaSResourceId\":\"a\",\"isHiddenSaaS\":false}") + .toObject(LatestLinkedSaaSResponseInner.class); + Assertions.assertEquals("a", model.saaSResourceId()); + Assertions.assertFalse(model.isHiddenSaaS()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ManagedServiceIdentityTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..43dc364b85c8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentity; +import com.azure.resourcemanager.commvaultcontentstore.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.commvaultcontentstore.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"dvkaozw\",\"tenantId\":\"ftyhxhurokf\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"lryplwckbasyy\":{\"principalId\":\"niwpwcukj\",\"clientId\":\"giawx\"},\"nqgoulzndli\":{\"principalId\":\"ddhsgcbacphe\",\"clientId\":\"ot\"},\"qqedqytbciqfou\":{\"principalId\":\"yqkgfg\",\"clientId\":\"madgakeqsrxyb\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("lryplwckbasyy", new UserAssignedIdentity(), "nqgoulzndli", + new UserAssignedIdentity(), "qqedqytbciqfou", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + // 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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/MarketplaceDetailsTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/MarketplaceDetailsTests.java new file mode 100644 index 000000000000..cc40bec57c5f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/MarketplaceDetailsTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.MarketplaceDetails; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceDetails model = BinaryData.fromString( + "{\"subscriptionId\":\"heotusiv\",\"subscriptionStatus\":\"PendingFulfillmentStart\",\"saasResourceId\":\"ciqihnhung\",\"offerDetails\":{\"publisherId\":\"wjzrnfygxgisp\",\"offerId\":\"mvtzfkufub\",\"planId\":\"ofx\",\"planName\":\"ofjaeqjhqjb\",\"termUnit\":\"v\",\"termId\":\"mjqulngsn\"}}") + .toObject(MarketplaceDetails.class); + Assertions.assertEquals("heotusiv", model.subscriptionId()); + Assertions.assertEquals("ciqihnhung", model.saasResourceId()); + Assertions.assertEquals("wjzrnfygxgisp", model.offerDetails().publisherId()); + Assertions.assertEquals("mvtzfkufub", model.offerDetails().offerId()); + Assertions.assertEquals("ofx", model.offerDetails().planId()); + Assertions.assertEquals("ofjaeqjhqjb", model.offerDetails().planName()); + Assertions.assertEquals("v", model.offerDetails().termUnit()); + Assertions.assertEquals("mjqulngsn", model.offerDetails().termId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MarketplaceDetails model = new MarketplaceDetails().withSubscriptionId("heotusiv") + .withSaasResourceId("ciqihnhung") + .withOfferDetails(new OfferDetails().withPublisherId("wjzrnfygxgisp") + .withOfferId("mvtzfkufub") + .withPlanId("ofx") + .withPlanName("ofjaeqjhqjb") + .withTermUnit("v") + .withTermId("mjqulngsn")); + model = BinaryData.fromObject(model).toObject(MarketplaceDetails.class); + Assertions.assertEquals("heotusiv", model.subscriptionId()); + Assertions.assertEquals("ciqihnhung", model.saasResourceId()); + Assertions.assertEquals("wjzrnfygxgisp", model.offerDetails().publisherId()); + Assertions.assertEquals("mvtzfkufub", model.offerDetails().offerId()); + Assertions.assertEquals("ofx", model.offerDetails().planId()); + Assertions.assertEquals("ofjaeqjhqjb", model.offerDetails().planName()); + Assertions.assertEquals("v", model.offerDetails().termUnit()); + Assertions.assertEquals("mjqulngsn", model.offerDetails().termId()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OfferDetailsTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OfferDetailsTests.java new file mode 100644 index 000000000000..04daa670938d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OfferDetailsTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.OfferDetails; +import org.junit.jupiter.api.Assertions; + +public final class OfferDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferDetails model = BinaryData.fromString( + "{\"publisherId\":\"nbybkzgcwrwcl\",\"offerId\":\"xwrljdouskcqvkoc\",\"planId\":\"jdkwtnhxbnjb\",\"planName\":\"sqrglssainq\",\"termUnit\":\"wnzlljfmppeeb\",\"termId\":\"gxsabkyq\"}") + .toObject(OfferDetails.class); + Assertions.assertEquals("nbybkzgcwrwcl", model.publisherId()); + Assertions.assertEquals("xwrljdouskcqvkoc", model.offerId()); + Assertions.assertEquals("jdkwtnhxbnjb", model.planId()); + Assertions.assertEquals("sqrglssainq", model.planName()); + Assertions.assertEquals("wnzlljfmppeeb", model.termUnit()); + Assertions.assertEquals("gxsabkyq", model.termId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OfferDetails model = new OfferDetails().withPublisherId("nbybkzgcwrwcl") + .withOfferId("xwrljdouskcqvkoc") + .withPlanId("jdkwtnhxbnjb") + .withPlanName("sqrglssainq") + .withTermUnit("wnzlljfmppeeb") + .withTermId("gxsabkyq"); + model = BinaryData.fromObject(model).toObject(OfferDetails.class); + Assertions.assertEquals("nbybkzgcwrwcl", model.publisherId()); + Assertions.assertEquals("xwrljdouskcqvkoc", model.offerId()); + Assertions.assertEquals("jdkwtnhxbnjb", model.planId()); + Assertions.assertEquals("sqrglssainq", model.planName()); + Assertions.assertEquals("wnzlljfmppeeb", model.termUnit()); + Assertions.assertEquals("gxsabkyq", model.termId()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationDisplayTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..d553724f7fbb --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationInnerTests.java new file mode 100644 index 000000000000..ee2ee4d99a97 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationListResultTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationListResultTests.java new file mode 100644 index 000000000000..10611f75b1d3 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationsListMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..c4046901cb2a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/OperationsListMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.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\":\"eae\",\"isDataAction\":false,\"display\":{\"provider\":\"atklddxbjhwuaa\",\"resource\":\"zjosp\",\"operation\":\"oulpjrv\",\"description\":\"glrvimjwosytxi\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.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/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlanPropertiesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlanPropertiesTests.java new file mode 100644 index 000000000000..97a4f3c61ac1 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlanPropertiesTests.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.Retention; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Schedule; +import com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PlanPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlanProperties model = BinaryData.fromString( + "{\"location\":\"vyvdcs\",\"storagePlans\":[{\"name\":\"ynnaam\",\"storagePoolId\":\"ctehfiqscjey\",\"copyName\":\"hezrkgq\",\"copyPrecedence\":1290040732,\"retentionPeriod\":1874212634,\"retentionTime\":\"monthly\",\"backupRuleType\":\"YEARLY_FULLS\",\"extendedRetention\":[{\"retentionTime\":\"monthly\",\"retentionPeriod\":1096221203,\"backupRuleType\":\"MONTHLY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":1769493620,\"backupRuleType\":\"DAILY_FULLS\"},{\"retentionTime\":\"yearly\",\"retentionPeriod\":203599917,\"backupRuleType\":\"ALL_JOBS\"}]},{\"name\":\"ngj\",\"storagePoolId\":\"cczsq\",\"copyName\":\"hvmdajvnysounq\",\"copyPrecedence\":97546857,\"retentionPeriod\":1709538743,\"retentionTime\":\"yearly\",\"backupRuleType\":\"MONTHLY_FULLS\",\"extendedRetention\":[{\"retentionTime\":\"yearly\",\"retentionPeriod\":1106914506,\"backupRuleType\":\"MONTHLY_FULLS\"}]},{\"name\":\"mopjmc\",\"storagePoolId\":\"tuo\",\"copyName\":\"hfuiuaodsfc\",\"copyPrecedence\":1569730572,\"retentionPeriod\":1076562523,\"retentionTime\":\"yearly\",\"backupRuleType\":\"QUARTERLY_FULLS\",\"extendedRetention\":[{\"retentionTime\":\"yearly\",\"retentionPeriod\":1714527436,\"backupRuleType\":\"ALL_JOBS\"},{\"retentionTime\":\"yearly\",\"retentionPeriod\":1113167460,\"backupRuleType\":\"DAILY_FULLS\"},{\"retentionTime\":\"yearly\",\"retentionPeriod\":1016147904,\"backupRuleType\":\"MONTHLY_FULLS\"},{\"retentionTime\":\"yearly\",\"retentionPeriod\":1080863753,\"backupRuleType\":\"MONTHLY_FULLS\"}]},{\"name\":\"xw\",\"storagePoolId\":\"wqsmbsur\",\"copyName\":\"imoryocfsfksym\",\"copyPrecedence\":376493890,\"retentionPeriod\":666664165,\"retentionTime\":\"monthly\",\"backupRuleType\":\"ALL_JOBS\",\"extendedRetention\":[{\"retentionTime\":\"yearly\",\"retentionPeriod\":1167674004,\"backupRuleType\":\"DAILY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":2086943152,\"backupRuleType\":\"DAILY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":1085417867,\"backupRuleType\":\"DAILY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":592745122,\"backupRuleType\":\"HALF_YEARLY_FULLS\"}]}],\"schedules\":[{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":952204067,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"DAY\",\"monthOfYear\":\"SEPTEMBER\",\"dayOfMonth\":1829419035,\"weeklyDays\":[\"FRIDAY\"],\"time\":\"lexxbczwtru\",\"timeZone\":\"qzbqjvsov\"},{\"backupType\":\"FULL\",\"frequency\":\"daily\",\"runsEvery\":1882721753,\"weekOfMonth\":\"LAST\",\"dayOfWeek\":\"TUESDAY\",\"monthOfYear\":\"JUNE\",\"dayOfMonth\":1196709774,\"weeklyDays\":[\"MONDAY\",\"SATURDAY\"],\"time\":\"mflbv\",\"timeZone\":\"chrkcciwwzjuqk\"}],\"retention\":{\"numberOfSnapshots\":1786560396},\"provisioningState\":\"Failed\"}") + .toObject(PlanProperties.class); + Assertions.assertEquals("vyvdcs", model.location()); + Assertions.assertEquals("ynnaam", model.storagePlans().get(0).name()); + Assertions.assertEquals("ctehfiqscjey", model.storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("hezrkgq", model.storagePlans().get(0).copyName()); + Assertions.assertEquals(1290040732, model.storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1874212634, model.storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.MONTHLY, model.storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.YEARLY_FULLS, model.storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(RetentionTime.MONTHLY, + model.storagePlans().get(0).extendedRetention().get(0).retentionTime()); + Assertions.assertEquals(1096221203, model.storagePlans().get(0).extendedRetention().get(0).retentionPeriod()); + Assertions.assertEquals(BackupRuleType.MONTHLY_FULLS, + model.storagePlans().get(0).extendedRetention().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.BOTH, model.schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.MONTHLY, model.schedules().get(0).frequency()); + Assertions.assertEquals(952204067, model.schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.THIRD, model.schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.DAY, model.schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.SEPTEMBER, model.schedules().get(0).monthOfYear()); + Assertions.assertEquals(1829419035, model.schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.FRIDAY, model.schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("lexxbczwtru", model.schedules().get(0).time()); + Assertions.assertEquals("qzbqjvsov", model.schedules().get(0).timeZone()); + Assertions.assertEquals(1786560396, model.retention().numberOfSnapshots()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlanProperties model + = new PlanProperties().withLocation("vyvdcs") + .withStoragePlans(Arrays.asList( + new StoragePlan().withName("ynnaam") + .withStoragePoolId("ctehfiqscjey") + .withCopyName("hezrkgq") + .withCopyPrecedence(1290040732) + .withRetentionPeriod(1874212634) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.YEARLY_FULLS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(1096221203) + .withBackupRuleType(BackupRuleType.MONTHLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(1769493620) + .withBackupRuleType(BackupRuleType.DAILY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(203599917) + .withBackupRuleType(BackupRuleType.ALL_JOBS))), + new StoragePlan().withName("ngj") + .withStoragePoolId("cczsq") + .withCopyName("hvmdajvnysounq") + .withCopyPrecedence(97546857) + .withRetentionPeriod(1709538743) + .withRetentionTime(RetentionTime.YEARLY) + .withBackupRuleType(BackupRuleType.MONTHLY_FULLS) + .withExtendedRetention( + Arrays.asList(new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1106914506) + .withBackupRuleType(BackupRuleType.MONTHLY_FULLS))), + new StoragePlan().withName("mopjmc") + .withStoragePoolId("tuo") + .withCopyName("hfuiuaodsfc") + .withCopyPrecedence(1569730572) + .withRetentionPeriod(1076562523) + .withRetentionTime(RetentionTime.YEARLY) + .withBackupRuleType(BackupRuleType.QUARTERLY_FULLS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1714527436) + .withBackupRuleType(BackupRuleType.ALL_JOBS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1113167460) + .withBackupRuleType(BackupRuleType.DAILY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1016147904) + .withBackupRuleType(BackupRuleType.MONTHLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1080863753) + .withBackupRuleType(BackupRuleType.MONTHLY_FULLS))), + new StoragePlan().withName("xw") + .withStoragePoolId("wqsmbsur") + .withCopyName("imoryocfsfksym") + .withCopyPrecedence(376493890) + .withRetentionPeriod(666664165) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.YEARLY) + .withRetentionPeriod(1167674004) + .withBackupRuleType(BackupRuleType.DAILY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(2086943152) + .withBackupRuleType(BackupRuleType.DAILY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(1085417867) + .withBackupRuleType(BackupRuleType.DAILY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(592745122) + .withBackupRuleType(BackupRuleType.HALF_YEARLY_FULLS))))) + .withSchedules(Arrays.asList( + new Schedule().withBackupType(BackUpType.BOTH) + .withFrequency(Frequency.MONTHLY) + .withRunsEvery(952204067) + .withWeekOfMonth(WeekOfMonth.THIRD) + .withDayOfWeek(DayOfWeek.DAY) + .withMonthOfYear(MonthOfYear.SEPTEMBER) + .withDayOfMonth(1829419035) + .withWeeklyDays(Arrays.asList(WeeklyDays.FRIDAY)) + .withTime("lexxbczwtru") + .withTimeZone("qzbqjvsov"), + new Schedule().withBackupType(BackUpType.FULL) + .withFrequency(Frequency.DAILY) + .withRunsEvery(1882721753) + .withWeekOfMonth(WeekOfMonth.LAST) + .withDayOfWeek(DayOfWeek.TUESDAY) + .withMonthOfYear(MonthOfYear.JUNE) + .withDayOfMonth(1196709774) + .withWeeklyDays(Arrays.asList(WeeklyDays.MONDAY, WeeklyDays.SATURDAY)) + .withTime("mflbv") + .withTimeZone("chrkcciwwzjuqk"))) + .withRetention(new Retention().withNumberOfSnapshots(1786560396)); + model = BinaryData.fromObject(model).toObject(PlanProperties.class); + Assertions.assertEquals("vyvdcs", model.location()); + Assertions.assertEquals("ynnaam", model.storagePlans().get(0).name()); + Assertions.assertEquals("ctehfiqscjey", model.storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("hezrkgq", model.storagePlans().get(0).copyName()); + Assertions.assertEquals(1290040732, model.storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1874212634, model.storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.MONTHLY, model.storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.YEARLY_FULLS, model.storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(RetentionTime.MONTHLY, + model.storagePlans().get(0).extendedRetention().get(0).retentionTime()); + Assertions.assertEquals(1096221203, model.storagePlans().get(0).extendedRetention().get(0).retentionPeriod()); + Assertions.assertEquals(BackupRuleType.MONTHLY_FULLS, + model.storagePlans().get(0).extendedRetention().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.BOTH, model.schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.MONTHLY, model.schedules().get(0).frequency()); + Assertions.assertEquals(952204067, model.schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.THIRD, model.schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.DAY, model.schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.SEPTEMBER, model.schedules().get(0).monthOfYear()); + Assertions.assertEquals(1829419035, model.schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.FRIDAY, model.schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("lexxbczwtru", model.schedules().get(0).time()); + Assertions.assertEquals("qzbqjvsov", model.schedules().get(0).timeZone()); + Assertions.assertEquals(1786560396, model.retention().numberOfSnapshots()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansCreateOrupdateMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansCreateOrupdateMockTests.java new file mode 100644 index 000000000000..898e40446d69 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansCreateOrupdateMockTests.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.CommvaultPlan; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.PlanProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.Retention; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.Schedule; +import com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PlansCreateOrupdateMockTests { + @Test + public void testCreateOrupdate() throws Exception { + String responseStr + = "{\"properties\":{\"location\":\"lwfffi\",\"storagePlans\":[{\"name\":\"pjpqqmtedltmmji\",\"storagePoolId\":\"eozphv\",\"copyName\":\"uyqncygupkvipmd\",\"copyPrecedence\":497556076,\"retentionPeriod\":1651652179,\"retentionTime\":\"monthly\",\"backupRuleType\":\"ALL_FULLS\",\"extendedRetention\":[{},{},{},{}]}],\"schedules\":[{\"backupType\":\"BOTH\",\"frequency\":\"weekly\",\"runsEvery\":1386174682,\"weekOfMonth\":\"LAST\",\"dayOfWeek\":\"SUNDAY\",\"monthOfYear\":\"APRIL\",\"dayOfMonth\":1731267363,\"weeklyDays\":[\"WEDNESDAY\"],\"time\":\"vhixbjxy\",\"timeZone\":\"n\"},{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":204909461,\"weekOfMonth\":\"FIRST\",\"dayOfWeek\":\"DAY\",\"monthOfYear\":\"JUNE\",\"dayOfMonth\":156092628,\"weeklyDays\":[\"SUNDAY\",\"SUNDAY\"],\"time\":\"jrywvtylbfpnc\",\"timeZone\":\"doiwi\"}],\"retention\":{\"numberOfSnapshots\":916023671},\"provisioningState\":\"Succeeded\"},\"id\":\"b\",\"name\":\"cbihwqk\",\"type\":\"fdntwjchrdgoih\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CommvaultPlan response = manager.plans() + .define("htpwij") + .withExistingCloudAccount("hbpnaixexccbd", "eaxhcexdrrvqahqk") + .withProperties(new PlanProperties().withLocation("yjsvfyc") + .withStoragePlans(Arrays.asList(new StoragePlan().withName("bfvoowvrv") + .withStoragePoolId("gjqppy") + .withCopyName("tronzmyhgfi") + .withCopyPrecedence(884290238) + .withRetentionPeriod(1762342215) + .withRetentionTime(RetentionTime.YEARLY) + .withBackupRuleType(BackupRuleType.DAILY_FULLS) + .withExtendedRetention(Arrays.asList(new ExtendedRetentionTime(), new ExtendedRetentionTime())))) + .withSchedules(Arrays.asList( + new Schedule().withBackupType(BackUpType.INCREMENTAL) + .withFrequency(Frequency.MONTHLY) + .withRunsEvery(1616110653) + .withWeekOfMonth(WeekOfMonth.THIRD) + .withDayOfWeek(DayOfWeek.THURSDAY) + .withMonthOfYear(MonthOfYear.JANUARY) + .withDayOfMonth(1263462710) + .withWeeklyDays(Arrays.asList(WeeklyDays.WEDNESDAY)) + .withTime("kxw") + .withTimeZone("olbq"), + new Schedule().withBackupType(BackUpType.INCREMENTAL) + .withFrequency(Frequency.MINUTES) + .withRunsEvery(182360383) + .withWeekOfMonth(WeekOfMonth.FOURTH) + .withDayOfWeek(DayOfWeek.THURSDAY) + .withMonthOfYear(MonthOfYear.AUGUST) + .withDayOfMonth(2091794134) + .withWeeklyDays(Arrays.asList(WeeklyDays.WEDNESDAY, WeeklyDays.TUESDAY)) + .withTime("wjxeznoigbr") + .withTimeZone("w"), + new Schedule().withBackupType(BackUpType.FULL) + .withFrequency(Frequency.YEARLY) + .withRunsEvery(703556051) + .withWeekOfMonth(WeekOfMonth.SECOND) + .withDayOfWeek(DayOfWeek.DAY) + .withMonthOfYear(MonthOfYear.FEBRUARY) + .withDayOfMonth(2849760) + .withWeeklyDays(Arrays.asList(WeeklyDays.SUNDAY, WeeklyDays.SUNDAY, WeeklyDays.FRIDAY)) + .withTime("xttaugzxnfaaz") + .withTimeZone("dtnkdmkq"))) + .withRetention(new Retention().withNumberOfSnapshots(1599276558))) + .create(); + + Assertions.assertEquals("lwfffi", response.properties().location()); + Assertions.assertEquals("pjpqqmtedltmmji", response.properties().storagePlans().get(0).name()); + Assertions.assertEquals("eozphv", response.properties().storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("uyqncygupkvipmd", response.properties().storagePlans().get(0).copyName()); + Assertions.assertEquals(497556076, response.properties().storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1651652179, response.properties().storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.MONTHLY, response.properties().storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.ALL_FULLS, response.properties().storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.BOTH, response.properties().schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.WEEKLY, response.properties().schedules().get(0).frequency()); + Assertions.assertEquals(1386174682, response.properties().schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.LAST, response.properties().schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.SUNDAY, response.properties().schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.APRIL, response.properties().schedules().get(0).monthOfYear()); + Assertions.assertEquals(1731267363, response.properties().schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.WEDNESDAY, response.properties().schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("vhixbjxy", response.properties().schedules().get(0).time()); + Assertions.assertEquals("n", response.properties().schedules().get(0).timeZone()); + Assertions.assertEquals(916023671, response.properties().retention().numberOfSnapshots()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansGetWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansGetWithResponseMockTests.java new file mode 100644 index 000000000000..9bb0da44d79f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansGetWithResponseMockTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.CommvaultPlan; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +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 PlansGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"location\":\"gofel\",\"storagePlans\":[{\"name\":\"grqmqhldvrii\",\"storagePoolId\":\"jnalghf\",\"copyName\":\"tvsexsowuel\",\"copyPrecedence\":1968234640,\"retentionPeriod\":1709132634,\"retentionTime\":\"yearly\",\"backupRuleType\":\"ALL_JOBS\",\"extendedRetention\":[{}]}],\"schedules\":[{\"backupType\":\"BOTH\",\"frequency\":\"yearly\",\"runsEvery\":3188606,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"THURSDAY\",\"monthOfYear\":\"MARCH\",\"dayOfMonth\":1207010106,\"weeklyDays\":[\"MONDAY\"],\"time\":\"hqxujxukndxdi\",\"timeZone\":\"jguufzdm\"}],\"retention\":{\"numberOfSnapshots\":918894528},\"provisioningState\":\"Succeeded\"},\"id\":\"whbotzingamv\",\"name\":\"phoszqz\",\"type\":\"dphqamv\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CommvaultPlan response = manager.plans() + .getWithResponse("zszrnwoiindfpw", "jylwbtlhflsj", "dhszfjv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("gofel", response.properties().location()); + Assertions.assertEquals("grqmqhldvrii", response.properties().storagePlans().get(0).name()); + Assertions.assertEquals("jnalghf", response.properties().storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("tvsexsowuel", response.properties().storagePlans().get(0).copyName()); + Assertions.assertEquals(1968234640, response.properties().storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(1709132634, response.properties().storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.YEARLY, response.properties().storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.ALL_JOBS, response.properties().storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.BOTH, response.properties().schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.YEARLY, response.properties().schedules().get(0).frequency()); + Assertions.assertEquals(3188606, response.properties().schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.THIRD, response.properties().schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.THURSDAY, response.properties().schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.MARCH, response.properties().schedules().get(0).monthOfYear()); + Assertions.assertEquals(1207010106, response.properties().schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.MONDAY, response.properties().schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("hqxujxukndxdi", response.properties().schedules().get(0).time()); + Assertions.assertEquals("jguufzdm", response.properties().schedules().get(0).timeZone()); + Assertions.assertEquals(918894528, response.properties().retention().numberOfSnapshots()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansListByCloudAccountMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansListByCloudAccountMockTests.java new file mode 100644 index 000000000000..692b6efb9adc --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/PlansListByCloudAccountMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.CommvaultPlan; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +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 PlansListByCloudAccountMockTests { + @Test + public void testListByCloudAccount() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"location\":\"nvyq\",\"storagePlans\":[{\"name\":\"tkzwpcnpwzc\",\"storagePoolId\":\"esgvvsccyaj\",\"copyName\":\"qfhwyg\",\"copyPrecedence\":376601626,\"retentionPeriod\":307379599,\"retentionTime\":\"yearly\",\"backupRuleType\":\"YEARLY_FULLS\",\"extendedRetention\":[{},{},{},{}]},{\"name\":\"mdwzrmuhapfcqdps\",\"storagePoolId\":\"qvpsvuoymg\",\"copyName\":\"elvezrypq\",\"copyPrecedence\":643673289,\"retentionPeriod\":1526160673,\"retentionTime\":\"yearly\",\"backupRuleType\":\"MONTHLY_FULLS\",\"extendedRetention\":[{},{},{}]},{\"name\":\"yhko\",\"storagePoolId\":\"pg\",\"copyName\":\"dkow\",\"copyPrecedence\":818081451,\"retentionPeriod\":313036289,\"retentionTime\":\"yearly\",\"backupRuleType\":\"MONTHLY_FULLS\",\"extendedRetention\":[{},{},{},{}]}],\"schedules\":[{\"backupType\":\"BOTH\",\"frequency\":\"daily\",\"runsEvery\":1777437887,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"FRIDAY\",\"monthOfYear\":\"JUNE\",\"dayOfMonth\":1000927704,\"weeklyDays\":[\"TUESDAY\"],\"time\":\"htjsying\",\"timeZone\":\"qatmtdhtmdvy\"},{\"backupType\":\"INCREMENTAL\",\"frequency\":\"daily\",\"runsEvery\":1506382079,\"weekOfMonth\":\"SECOND\",\"dayOfWeek\":\"THURSDAY\",\"monthOfYear\":\"NOVEMBER\",\"dayOfMonth\":749010176,\"weeklyDays\":[\"TUESDAY\",\"THURSDAY\",\"THURSDAY\",\"TUESDAY\"],\"time\":\"kj\",\"timeZone\":\"rvqqaatj\"},{\"backupType\":\"INCREMENTAL\",\"frequency\":\"monthly\",\"runsEvery\":1624870428,\"weekOfMonth\":\"THIRD\",\"dayOfWeek\":\"SATURDAY\",\"monthOfYear\":\"NOVEMBER\",\"dayOfMonth\":327362442,\"weeklyDays\":[\"SATURDAY\"],\"time\":\"ool\",\"timeZone\":\"wxkvtkkgll\"},{\"backupType\":\"BOTH\",\"frequency\":\"monthly\",\"runsEvery\":1337404420,\"weekOfMonth\":\"SECOND\",\"dayOfWeek\":\"SATURDAY\",\"monthOfYear\":\"APRIL\",\"dayOfMonth\":1371446568,\"weeklyDays\":[\"WEDNESDAY\"],\"time\":\"hbxvvyhgsopbyrqu\",\"timeZone\":\"g\"}],\"retention\":{\"numberOfSnapshots\":455492587},\"provisioningState\":\"Succeeded\"},\"id\":\"nhlmctlpdng\",\"name\":\"tvgbmhrixkwmy\",\"type\":\"jejveg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.plans().listByCloudAccount("kfwynw", "vtbvkayh", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nvyq", response.iterator().next().properties().location()); + Assertions.assertEquals("tkzwpcnpwzc", response.iterator().next().properties().storagePlans().get(0).name()); + Assertions.assertEquals("esgvvsccyaj", + response.iterator().next().properties().storagePlans().get(0).storagePoolId()); + Assertions.assertEquals("qfhwyg", response.iterator().next().properties().storagePlans().get(0).copyName()); + Assertions.assertEquals(376601626, + response.iterator().next().properties().storagePlans().get(0).copyPrecedence()); + Assertions.assertEquals(307379599, + response.iterator().next().properties().storagePlans().get(0).retentionPeriod()); + Assertions.assertEquals(RetentionTime.YEARLY, + response.iterator().next().properties().storagePlans().get(0).retentionTime()); + Assertions.assertEquals(BackupRuleType.YEARLY_FULLS, + response.iterator().next().properties().storagePlans().get(0).backupRuleType()); + Assertions.assertEquals(BackUpType.BOTH, + response.iterator().next().properties().schedules().get(0).backupType()); + Assertions.assertEquals(Frequency.DAILY, + response.iterator().next().properties().schedules().get(0).frequency()); + Assertions.assertEquals(1777437887, response.iterator().next().properties().schedules().get(0).runsEvery()); + Assertions.assertEquals(WeekOfMonth.THIRD, + response.iterator().next().properties().schedules().get(0).weekOfMonth()); + Assertions.assertEquals(DayOfWeek.FRIDAY, + response.iterator().next().properties().schedules().get(0).dayOfWeek()); + Assertions.assertEquals(MonthOfYear.JUNE, + response.iterator().next().properties().schedules().get(0).monthOfYear()); + Assertions.assertEquals(1000927704, response.iterator().next().properties().schedules().get(0).dayOfMonth()); + Assertions.assertEquals(WeeklyDays.TUESDAY, + response.iterator().next().properties().schedules().get(0).weeklyDays().get(0)); + Assertions.assertEquals("htjsying", response.iterator().next().properties().schedules().get(0).time()); + Assertions.assertEquals("qatmtdhtmdvy", response.iterator().next().properties().schedules().get(0).timeZone()); + Assertions.assertEquals(455492587, response.iterator().next().properties().retention().numberOfSnapshots()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemInnerTests.java new file mode 100644 index 000000000000..df1702958e3b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemInnerTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectedItemInner; + +public final class ProtectedItemInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectedItemInner model = BinaryData.fromString( + "{\"properties\":{\"resourceName\":\"q\",\"lastBackUpTime\":901362477495436627,\"resourceGroup\":\"tmuwlauwzi\",\"location\":\"xbmp\",\"vmGuid\":\"cjefuzmu\"},\"id\":\"bttdumorppxe\",\"name\":\"mnzb\",\"type\":\"bhjpglkfgohdne\"}") + .toObject(ProtectedItemInner.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemListResultTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemListResultTests.java new file mode 100644 index 000000000000..9af79d26ff2d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemListResultTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.ProtectedItemListResult; +import org.junit.jupiter.api.Assertions; + +public final class ProtectedItemListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectedItemListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"resourceName\":\"ohfwds\",\"lastBackUpTime\":865048723597164706,\"resourceGroup\":\"aljutiiswac\",\"location\":\"fgdkzzew\",\"vmGuid\":\"fvhqc\"},\"id\":\"ilvpnppfuflrwd\",\"name\":\"hdlxyjrxsagafcn\",\"type\":\"hgw\"},{\"properties\":{\"resourceName\":\"pnedgf\",\"lastBackUpTime\":6066782690220181009,\"resourceGroup\":\"kcvqvpke\",\"location\":\"dcvd\",\"vmGuid\":\"hvoodsotbobzd\"},\"id\":\"cjwvn\",\"name\":\"dldwmgxc\",\"type\":\"rslpmutwuoeg\"},{\"properties\":{\"resourceName\":\"khjwn\",\"lastBackUpTime\":7297280176349550592,\"resourceGroup\":\"sluicpdggkzz\",\"location\":\"vmbmp\",\"vmGuid\":\"xmodf\"},\"id\":\"efyw\",\"name\":\"bpfvm\",\"type\":\"yhrfouyftaakcpw\"}],\"nextLink\":\"zvqtmnubexkp\"}") + .toObject(ProtectedItemListResult.class); + Assertions.assertEquals("zvqtmnubexkp", model.nextLink()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemPropertiesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemPropertiesTests.java new file mode 100644 index 000000000000..489a33cd5197 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemPropertiesTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItemProperties; + +public final class ProtectedItemPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectedItemProperties model = BinaryData.fromString( + "{\"resourceName\":\"el\",\"lastBackUpTime\":8489866471664933355,\"resourceGroup\":\"sdyhtozfikdowwq\",\"location\":\"uvxzxclvi\",\"vmGuid\":\"hhqzonosgg\"}") + .toObject(ProtectedItemProperties.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetRestorePointsWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetRestorePointsWithResponseMockTests.java new file mode 100644 index 000000000000..691b1d335084 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetRestorePointsWithResponseMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.RestorePoints; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectedItemsGetRestorePointsWithResponseMockTests { + @Test + public void testGetRestorePointsWithResponse() throws Exception { + String responseStr = "{\"restoreTimes\":[7653162173647164897]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RestorePoints response = manager.protectedItems() + .getRestorePointsWithResponse("ksbpimlqoljx", "cgxxlxs", "fgcviz", "zdwlvwlyoupfgfb", + com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetWithResponseMockTests.java new file mode 100644 index 000000000000..935d688fdfe9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsGetWithResponseMockTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItem; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectedItemsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"resourceName\":\"nrwrbiork\",\"lastBackUpTime\":1294897435349030649,\"resourceGroup\":\"ywjhhgdnhx\",\"location\":\"sivfomilo\",\"vmGuid\":\"ggdufiqndieu\"},\"id\":\"ofjchvcyyysf\",\"name\":\"dotcubiipuip\",\"type\":\"oqonma\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ProtectedItem response = manager.protectedItems() + .getWithResponse("axconfozauo", "sukokwbqplhl", "nuuepzlrp", "wzsoldweyuqdunv", + com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsListByProtectionGroupMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsListByProtectionGroupMockTests.java new file mode 100644 index 000000000000..40753feae61c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsListByProtectionGroupMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectedItem; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectedItemsListByProtectionGroupMockTests { + @Test + public void testListByProtectionGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"resourceName\":\"rilbywdx\",\"lastBackUpTime\":7966238893835264976,\"resourceGroup\":\"ccwr\",\"location\":\"fscjfnynszquji\",\"vmGuid\":\"dvoqyt\"},\"id\":\"yo\",\"name\":\"bblgyavut\",\"type\":\"thjoxoism\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.protectedItems() + .listByProtectionGroup("jeknizshq", "cimpevfg", "b", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsOperationGroupsCountByProtectionGroupsWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsOperationGroupsCountByProtectionGroupsWithResponseMockTests.java new file mode 100644 index 000000000000..b2c6be026f12 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsOperationGroupsCountByProtectionGroupsWithResponseMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.CountProtectedItemsResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectedItemsOperationGroupsCountByProtectionGroupsWithResponseMockTests { + @Test + public void testCountByProtectionGroupsWithResponse() throws Exception { + String responseStr = "{\"count\":\"tcyohpfkyrk\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CountProtectedItemsResponse response = manager.protectedItemsOperationGroups() + .countByProtectionGroupsWithResponse( + new CountProtectedItemsRequest().withResourceIds(Arrays.asList("kkudzp", "gwjplmag")), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("tcyohpfkyrk", response.count()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsRestoreWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsRestoreWithResponseMockTests.java new file mode 100644 index 000000000000..d700f1d8a78c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectedItemsRestoreWithResponseMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectedItemsRestoreWithResponseMockTests { + @Test + public void testRestoreWithResponse() throws Exception { + String responseStr = "{\"taskId\":15369485,\"jobIds\":[\"yvudtjuewbci\",\"xuuwhcj\",\"xccybvpa\"]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RestoreProtectionItemResponse response = manager.protectedItems() + .restoreWithResponse("dyhgkfminsg", "wzf", "tsttktlahbq", "ctxtgzukxi", + new RestoreProtectionItemRequest().withInPlaceRestore(true) + .withRestoreType(RestoreType.DISK_ATTACH) + .withToTime("gqqqxh") + .withVmDestinationInfo( + new VmDestinationInfo().withVmInfoList(Arrays.asList(new VmInfo().withSourceVmGuid("xrxc") + .withStorageAccountId("juisavokqdzf") + .withPowerOnVmAfterRestore(false) + .withName("vjlfrqtt") + .withResourceGroup("jlkatnwxy") + .withRegion("pidkqqfkuvscxkdm") + .withNetworkId("govibrxkpmloazu") + .withSubnetId("ocbgoorbteoyb") + .withAttachAndSwapOsDisk(false) + .withTargetVmGuid("akvvjgslordi") + .withVmtags(Arrays.asList(new VmTag().withName("wwtkg").withValue("xnyed")))))), + com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupInnerTests.java new file mode 100644 index 000000000000..db34f4e1fe78 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupInnerTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.ProtectionGroupInner; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionGroupInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionGroupInner model = BinaryData.fromString( + "{\"properties\":{\"plan\":\"otogtwrupqs\",\"resources\":{\"manual\":[\"micykvceoveilo\"],\"matchRules\":{\"rules\":[{\"property\":\"region\",\"operator\":\"startsWith\",\"value\":\"fj\"}],\"matchType\":\"any\"}},\"protectionStatus\":\"pending\",\"numberOfProtectedItems\":197964626,\"lastBackUpTime\":6237049222679473595,\"backupActivityStatus\":\"hbttkphyw\",\"provisioningState\":\"Canceled\"},\"id\":\"t\",\"name\":\"qnermclfplphoxu\",\"type\":\"crpab\"}") + .toObject(ProtectionGroupInner.class); + Assertions.assertEquals("otogtwrupqs", model.properties().plan()); + Assertions.assertEquals("micykvceoveilo", model.properties().resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.REGION, + model.properties().resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.STARTS_WITH, + model.properties().resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("fj", model.properties().resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, model.properties().resources().matchRules().matchType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionGroupInner model = new ProtectionGroupInner().withProperties(new ProtectionGroupProperties() + .withPlan("otogtwrupqs") + .withResources(new ProtectionGroupResources().withManual(Arrays.asList("micykvceoveilo")) + .withMatchRules(new ProtectionGroupResourcesMatchRules().withRules(Arrays.asList( + new Rule().withProperty(RuleProperty.REGION).withOperator(Operator.STARTS_WITH).withValue("fj"))) + .withMatchType(MatchType.ANY)))); + model = BinaryData.fromObject(model).toObject(ProtectionGroupInner.class); + Assertions.assertEquals("otogtwrupqs", model.properties().plan()); + Assertions.assertEquals("micykvceoveilo", model.properties().resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.REGION, + model.properties().resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.STARTS_WITH, + model.properties().resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("fj", model.properties().resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, model.properties().resources().matchRules().matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupListResultTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupListResultTests.java new file mode 100644 index 000000000000..f270a1d27f79 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupListResultTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.ProtectionGroupListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionGroupListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionGroupListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"plan\":\"fadmws\",\"resources\":{\"manual\":[\"gvxp\"],\"matchRules\":{\"rules\":[{\"property\":\"tagName\",\"operator\":\"doesNotEqual\",\"value\":\"lf\"},{\"property\":\"resourceGroup\",\"operator\":\"contains\",\"value\":\"gwb\"}],\"matchType\":\"all\"}},\"protectionStatus\":\"discovered\",\"numberOfProtectedItems\":78191983,\"lastBackUpTime\":2980894048729421181,\"backupActivityStatus\":\"baliourqhakauha\",\"provisioningState\":\"Canceled\"},\"id\":\"wxosowzxcug\",\"name\":\"cjooxdjebwpucwwf\",\"type\":\"ovbvmeueciv\"},{\"properties\":{\"plan\":\"zceuojgjrw\",\"resources\":{\"manual\":[\"iotwmcdytdxwit\",\"nrjawgqwg\",\"hniskxfbkpyc\"],\"matchRules\":{\"rules\":[{\"property\":\"tagValue\",\"operator\":\"endsWith\",\"value\":\"dnhjdauwhvylw\"}],\"matchType\":\"any\"}},\"protectionStatus\":\"protected\",\"numberOfProtectedItems\":776701007,\"lastBackUpTime\":4211220470844188894,\"backupActivityStatus\":\"bm\",\"provisioningState\":\"Canceled\"},\"id\":\"wpr\",\"name\":\"qlveualupjmkh\",\"type\":\"xobbcswsrt\"},{\"properties\":{\"plan\":\"iplrbpbewtghfgb\",\"resources\":{\"manual\":[\"wxzvlvqhjkb\"],\"matchRules\":{\"rules\":[{\"property\":\"tagName\",\"operator\":\"startsWith\",\"value\":\"nmxiebwwaloayqc\"},{\"property\":\"resourceGroup\",\"operator\":\"contains\",\"value\":\"tzjuzgwyzmhtxo\"},{\"property\":\"name\",\"operator\":\"endsWith\",\"value\":\"ts\"},{\"property\":\"tagName\",\"operator\":\"startsWith\",\"value\":\"cbpwxqpsrknft\"}],\"matchType\":\"any\"}},\"protectionStatus\":\"protected\",\"numberOfProtectedItems\":987025721,\"lastBackUpTime\":1487158993534202895,\"backupActivityStatus\":\"mdyvxqtayriw\",\"provisioningState\":\"Succeeded\"},\"id\":\"qbex\",\"name\":\"mcqibycnojv\",\"type\":\"nmefqsgzvahapj\"}],\"nextLink\":\"hpvgqz\"}") + .toObject(ProtectionGroupListResult.class); + Assertions.assertEquals("fadmws", model.value().get(0).properties().plan()); + Assertions.assertEquals("gvxp", model.value().get(0).properties().resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.TAG_NAME, + model.value().get(0).properties().resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.DOES_NOT_EQUAL, + model.value().get(0).properties().resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("lf", + model.value().get(0).properties().resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ALL, model.value().get(0).properties().resources().matchRules().matchType()); + Assertions.assertEquals("hpvgqz", model.nextLink()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupPropertiesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupPropertiesTests.java new file mode 100644 index 000000000000..5d10cc8e2d2c --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupPropertiesTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionGroupPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionGroupProperties model = BinaryData.fromString( + "{\"plan\":\"ye\",\"resources\":{\"manual\":[\"jta\",\"qugxywpmueefjzwf\",\"kqujidsuyono\",\"glaocq\"],\"matchRules\":{\"rules\":[{\"property\":\"tagName\",\"operator\":\"contains\",\"value\":\"g\"}],\"matchType\":\"any\"}},\"protectionStatus\":\"pending\",\"numberOfProtectedItems\":1613065996,\"lastBackUpTime\":5579898580342682580,\"backupActivityStatus\":\"rxv\",\"provisioningState\":\"Failed\"}") + .toObject(ProtectionGroupProperties.class); + Assertions.assertEquals("ye", model.plan()); + Assertions.assertEquals("jta", model.resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.TAG_NAME, model.resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.CONTAINS, model.resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("g", model.resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, model.resources().matchRules().matchType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionGroupProperties model + = new ProtectionGroupProperties().withPlan("ye") + .withResources(new ProtectionGroupResources() + .withManual(Arrays.asList("jta", "qugxywpmueefjzwf", "kqujidsuyono", "glaocq")) + .withMatchRules(new ProtectionGroupResourcesMatchRules().withRules(Arrays.asList( + new Rule().withProperty(RuleProperty.TAG_NAME).withOperator(Operator.CONTAINS).withValue("g"))) + .withMatchType(MatchType.ANY))); + model = BinaryData.fromObject(model).toObject(ProtectionGroupProperties.class); + Assertions.assertEquals("ye", model.plan()); + Assertions.assertEquals("jta", model.resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.TAG_NAME, model.resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.CONTAINS, model.resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("g", model.resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, model.resources().matchRules().matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupResourcesMatchRulesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupResourcesMatchRulesTests.java new file mode 100644 index 000000000000..33014b978fdc --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupResourcesMatchRulesTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionGroupResourcesMatchRulesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionGroupResourcesMatchRules model = BinaryData.fromString( + "{\"rules\":[{\"property\":\"region\",\"operator\":\"doesNotEqual\",\"value\":\"jusrtslhspk\"},{\"property\":\"name\",\"operator\":\"doesNotEqual\",\"value\":\"maofmxagkv\"},{\"property\":\"tagValue\",\"operator\":\"contains\",\"value\":\"lmqkrhahvlj\"},{\"property\":\"resourceGroup\",\"operator\":\"contains\",\"value\":\"aquhcdhm\"}],\"matchType\":\"any\"}") + .toObject(ProtectionGroupResourcesMatchRules.class); + Assertions.assertEquals(RuleProperty.REGION, model.rules().get(0).property()); + Assertions.assertEquals(Operator.DOES_NOT_EQUAL, model.rules().get(0).operator()); + Assertions.assertEquals("jusrtslhspk", model.rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, model.matchType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionGroupResourcesMatchRules model = new ProtectionGroupResourcesMatchRules().withRules(Arrays.asList( + new Rule().withProperty(RuleProperty.REGION).withOperator(Operator.DOES_NOT_EQUAL).withValue("jusrtslhspk"), + new Rule().withProperty(RuleProperty.NAME).withOperator(Operator.DOES_NOT_EQUAL).withValue("maofmxagkv"), + new Rule().withProperty(RuleProperty.TAG_VALUE).withOperator(Operator.CONTAINS).withValue("lmqkrhahvlj"), + new Rule().withProperty(RuleProperty.RESOURCE_GROUP).withOperator(Operator.CONTAINS).withValue("aquhcdhm"))) + .withMatchType(MatchType.ANY); + model = BinaryData.fromObject(model).toObject(ProtectionGroupResourcesMatchRules.class); + Assertions.assertEquals(RuleProperty.REGION, model.rules().get(0).property()); + Assertions.assertEquals(Operator.DOES_NOT_EQUAL, model.rules().get(0).operator()); + Assertions.assertEquals("jusrtslhspk", model.rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, model.matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupResourcesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupResourcesTests.java new file mode 100644 index 000000000000..bc3def255c7a --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupResourcesTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionGroupResourcesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionGroupResources model = BinaryData.fromString( + "{\"manual\":[\"pz\",\"txhdzh\",\"rqjbhckfrl\"],\"matchRules\":{\"rules\":[{\"property\":\"name\",\"operator\":\"endsWith\",\"value\":\"kyv\"},{\"property\":\"tagValue\",\"operator\":\"doesNotEqual\",\"value\":\"anuzbpzkafkuw\"},{\"property\":\"name\",\"operator\":\"endsWith\",\"value\":\"nwbmeh\"}],\"matchType\":\"all\"}}") + .toObject(ProtectionGroupResources.class); + Assertions.assertEquals("pz", model.manual().get(0)); + Assertions.assertEquals(RuleProperty.NAME, model.matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.ENDS_WITH, model.matchRules().rules().get(0).operator()); + Assertions.assertEquals("kyv", model.matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ALL, model.matchRules().matchType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionGroupResources model = new ProtectionGroupResources() + .withManual(Arrays.asList("pz", "txhdzh", "rqjbhckfrl")) + .withMatchRules(new ProtectionGroupResourcesMatchRules() + .withRules(Arrays.asList( + new Rule().withProperty(RuleProperty.NAME).withOperator(Operator.ENDS_WITH).withValue("kyv"), + new Rule().withProperty(RuleProperty.TAG_VALUE) + .withOperator(Operator.DOES_NOT_EQUAL) + .withValue("anuzbpzkafkuw"), + new Rule().withProperty(RuleProperty.NAME).withOperator(Operator.ENDS_WITH).withValue("nwbmeh"))) + .withMatchType(MatchType.ALL)); + model = BinaryData.fromObject(model).toObject(ProtectionGroupResources.class); + Assertions.assertEquals("pz", model.manual().get(0)); + Assertions.assertEquals(RuleProperty.NAME, model.matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.ENDS_WITH, model.matchRules().rules().get(0).operator()); + Assertions.assertEquals("kyv", model.matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ALL, model.matchRules().matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsBackupWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsBackupWithResponseMockTests.java new file mode 100644 index 000000000000..fafebee28ce8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsBackupWithResponseMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupLevel; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupOptions; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupProtectionGroupResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.VmListItem; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectionGroupsBackupWithResponseMockTests { + @Test + public void testBackupWithResponse() throws Exception { + String responseStr = "{\"taskId\":870827030,\"jobIds\":[\"ltfnhtbaxkgx\",\"wrck\",\"yklyhpluodpvruud\"]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + BackupProtectionGroupResponse response = manager.protectionGroups() + .backupWithResponse("qioknssxmojm", "vpkjpr", "kwcf", + new BackupProtectionGroupRequest().withVmList(Arrays.asList(new VmListItem().withVmGuid("ljyxgtczhe"))) + .withBackupOptions(new BackupOptions().withBackupLevel(BackupLevel.SYNTHETIC_FULL) + .withJobDescription("sdshmkxmaehvb") + .withBackupCopyImmediately(false) + .withRunSnapShotBackup(true) + .withNotifyUserOnJobCompletion(false)), + com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsCreateOrupdateMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsCreateOrupdateMockTests.java new file mode 100644 index 000000000000..ef2e5d614d2b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsCreateOrupdateMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroup; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResources; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroupResourcesMatchRules; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectionGroupsCreateOrupdateMockTests { + @Test + public void testCreateOrupdate() throws Exception { + String responseStr + = "{\"properties\":{\"plan\":\"utacoe\",\"resources\":{\"manual\":[\"ewzcjznmwcp\",\"guaadraufactkahz\"],\"matchRules\":{\"rules\":[{\"property\":\"resourceGroup\",\"operator\":\"startsWith\",\"value\":\"ziuxxpshnee\"},{\"property\":\"resourceGroup\",\"operator\":\"contains\",\"value\":\"fgslqubkwdl\"},{\"property\":\"resourceGroup\",\"operator\":\"doesNotContains\",\"value\":\"d\"},{\"property\":\"resourceGroup\",\"operator\":\"endsWith\",\"value\":\"ujbazpjuohminyfl\"}],\"matchType\":\"any\"}},\"protectionStatus\":\"discovered\",\"numberOfProtectedItems\":1354574729,\"lastBackUpTime\":6595563974366054506,\"backupActivityStatus\":\"klvxwmyg\",\"provisioningState\":\"Succeeded\"},\"id\":\"pqchiszep\",\"name\":\"nb\",\"type\":\"crxgibb\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ProtectionGroup response = manager.protectionGroups() + .define("odqkdlwwqfb") + .withExistingCloudAccount("gzibthostgktstv", "xeclzedqbcvhzlhp") + .withProperties(new ProtectionGroupProperties().withPlan("lkxt") + .withResources(new ProtectionGroupResources() + .withManual(Arrays.asList("fsmlmbtxhwgfw", "rtawcoezb", "hubskhudygooo", "kqfqjbvl")) + .withMatchRules(new ProtectionGroupResourcesMatchRules().withRules(Arrays.asList( + new Rule().withProperty(RuleProperty.STATUS) + .withOperator(Operator.STARTS_WITH) + .withValue("luiqtqzfavyvnqq"), + new Rule().withProperty(RuleProperty.RESOURCE_GROUP) + .withOperator(Operator.DOES_NOT_CONTAINS) + .withValue("ryeu"), + new Rule().withProperty(RuleProperty.TAG_NAME) + .withOperator(Operator.DOES_NOT_EQUAL) + .withValue("kq"))) + .withMatchType(MatchType.ANY)))) + .create(); + + Assertions.assertEquals("utacoe", response.properties().plan()); + Assertions.assertEquals("ewzcjznmwcp", response.properties().resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.RESOURCE_GROUP, + response.properties().resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.STARTS_WITH, + response.properties().resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("ziuxxpshnee", response.properties().resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, response.properties().resources().matchRules().matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsGetWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsGetWithResponseMockTests.java new file mode 100644 index 000000000000..ff222e2a43a0 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsGetWithResponseMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroup; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +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 ProtectionGroupsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"plan\":\"gseinq\",\"resources\":{\"manual\":[\"fxqknpirgneptt\",\"qmsniffcdmqnro\",\"lpijnkrxfrd\",\"hcrat\"],\"matchRules\":{\"rules\":[{\"property\":\"name\",\"operator\":\"equals\",\"value\":\"nasx\"},{\"property\":\"resourceGroup\",\"operator\":\"doesNotContains\",\"value\":\"ozqyzh\"},{\"property\":\"tagValue\",\"operator\":\"equals\",\"value\":\"esgogc\"}],\"matchType\":\"any\"}},\"protectionStatus\":\"all\",\"numberOfProtectedItems\":557997155,\"lastBackUpTime\":944538746812596310,\"backupActivityStatus\":\"nyhmossxkkgthr\",\"provisioningState\":\"Succeeded\"},\"id\":\"jbdhqxvc\",\"name\":\"gf\",\"type\":\"pdso\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ProtectionGroup response = manager.protectionGroups() + .getWithResponse("umwctondz", "luudfdlwggytsb", "tov", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("gseinq", response.properties().plan()); + Assertions.assertEquals("fxqknpirgneptt", response.properties().resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.NAME, + response.properties().resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.EQUALS, + response.properties().resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("nasx", response.properties().resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ANY, response.properties().resources().matchRules().matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsListByCloudAccountMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsListByCloudAccountMockTests.java new file mode 100644 index 000000000000..9a9411417ebf --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsListByCloudAccountMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.MatchType; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.ProtectionGroup; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +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 ProtectionGroupsListByCloudAccountMockTests { + @Test + public void testListByCloudAccount() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"plan\":\"bycnunvjsrtkf\",\"resources\":{\"manual\":[\"opqgikyzirtxdyux\",\"ejnt\",\"sewgioilqukr\",\"dxtqmieoxo\"],\"matchRules\":{\"rules\":[{\"property\":\"region\",\"operator\":\"endsWith\",\"value\":\"hyaomtbghhavgr\"},{\"property\":\"name\",\"operator\":\"contains\",\"value\":\"fo\"},{\"property\":\"status\",\"operator\":\"startsWith\",\"value\":\"hpjbib\"}],\"matchType\":\"all\"}},\"protectionStatus\":\"backed_up_with_error\",\"numberOfProtectedItems\":1758314943,\"lastBackUpTime\":7872237535456237102,\"backupActivityStatus\":\"luyovwxnbkfezzx\",\"provisioningState\":\"Succeeded\"},\"id\":\"wzdgirujbzbo\",\"name\":\"vzzbtdcq\",\"type\":\"pniyujviyl\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.protectionGroups().listByCloudAccount("bshrnsvbuswd", "z", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("bycnunvjsrtkf", response.iterator().next().properties().plan()); + Assertions.assertEquals("opqgikyzirtxdyux", + response.iterator().next().properties().resources().manual().get(0)); + Assertions.assertEquals(RuleProperty.REGION, + response.iterator().next().properties().resources().matchRules().rules().get(0).property()); + Assertions.assertEquals(Operator.ENDS_WITH, + response.iterator().next().properties().resources().matchRules().rules().get(0).operator()); + Assertions.assertEquals("hyaomtbghhavgr", + response.iterator().next().properties().resources().matchRules().rules().get(0).value()); + Assertions.assertEquals(MatchType.ALL, + response.iterator().next().properties().resources().matchRules().matchType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsRestoreWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsRestoreWithResponseMockTests.java new file mode 100644 index 000000000000..c7cbbfeb12a8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsRestoreWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemResponse; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectionGroupsRestoreWithResponseMockTests { + @Test + public void testRestoreWithResponse() throws Exception { + String responseStr = "{\"taskId\":239999134,\"jobIds\":[\"tduceamt\",\"czu\"]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RestoreProtectionItemResponse response = manager.protectionGroups() + .restoreWithResponse("dshf", "snrbgyefrymsgao", "fmwncotmrfh", + new RestoreProtectionItemRequest().withInPlaceRestore(false) + .withRestoreType(RestoreType.DISK_ATTACH) + .withToTime("moxoftpi") + .withVmDestinationInfo(new VmDestinationInfo().withVmInfoList(Arrays.asList( + new VmInfo().withSourceVmGuid("wycz") + .withStorageAccountId("hxacpqjlihhyu") + .withPowerOnVmAfterRestore(true) + .withName("asdvl") + .withResourceGroup("wdgzxulucv") + .withRegion("mrsreuzvxurisjnh") + .withNetworkId("txifqj") + .withSubnetId("xmrhu") + .withAttachAndSwapOsDisk(false) + .withTargetVmGuid("cesutrgjupauut") + .withVmtags(Arrays.asList(new VmTag().withName("qhih").withValue("jqgwzp"))), + new VmInfo().withSourceVmGuid("fqntcyp") + .withStorageAccountId("xjvfoimwksl") + .withPowerOnVmAfterRestore(true) + .withName("zjxvydfcea") + .withResourceGroup("lhvygdyftu") + .withRegion("twnawjslbiwkojgc") + .withNetworkId("tsf") + .withSubnetId("nbaeqphchqn") + .withAttachAndSwapOsDisk(false) + .withTargetVmGuid("x") + .withVmtags(Arrays.asList(new VmTag().withName("wrykqgai").withValue("mvikl"), + new VmTag().withName("ydv").withValue("hbejdznxcvdsrhnj"), + new VmTag().withName("volvtn").withValue("v"), + new VmTag().withName("fzg").withValue("mjdftu")))))), + com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsResumeBackupWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsResumeBackupWithResponseMockTests.java new file mode 100644 index 000000000000..7160b4554c5d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ProtectionGroupsResumeBackupWithResponseMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProtectionGroupsResumeBackupWithResponseMockTests { + @Test + public void testResumeBackupWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 204, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.protectionGroups().resumeBackupWithResponse("m", "jw", "w", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestorePointsInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestorePointsInnerTests.java new file mode 100644 index 000000000000..90666e1fba77 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestorePointsInnerTests.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. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestorePointsInner; + +public final class RestorePointsInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestorePointsInner model = BinaryData.fromString("{\"restoreTimes\":[5387832879483701613,6659081413348995373]}") + .toObject(RestorePointsInner.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestoreProtectionItemRequestTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestoreProtectionItemRequestTests.java new file mode 100644 index 000000000000..2bc7ae3b62a3 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestoreProtectionItemRequestTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreProtectionItemRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.RestoreType; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RestoreProtectionItemRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestoreProtectionItemRequest model = BinaryData.fromString( + "{\"inPlaceRestore\":false,\"restoreType\":\"DISK_ATTACH\",\"toTime\":\"zovawjvz\",\"vmDestinationInfo\":{\"vmInfoList\":[{\"sourceVmGuid\":\"luthn\",\"storageAccountId\":\"prnxipeil\",\"powerOnVmAfterRestore\":false,\"name\":\"aejxd\",\"resourceGroup\":\"tskzbbtdzumveek\",\"region\":\"wozuhkf\",\"networkId\":\"sjyofdx\",\"subnetId\":\"us\",\"attachAndSwapOsDisk\":true,\"targetVmGuid\":\"uwaboekqvke\",\"vmtags\":[{\"name\":\"mvb\",\"value\":\"wyjsflhhcaalnjix\"}]},{\"sourceVmGuid\":\"sxyawjoyaqcs\",\"storageAccountId\":\"yjpkiidzyexz\",\"powerOnVmAfterRestore\":true,\"name\":\"xhnrztfolhb\",\"resourceGroup\":\"knalaulppg\",\"region\":\"tpnapnyiropuhpig\",\"networkId\":\"gylgqgitxmedjvcs\",\"subnetId\":\"n\",\"attachAndSwapOsDisk\":true,\"targetVmGuid\":\"cwzzhxgktr\",\"vmtags\":[{\"name\":\"cnapkteoell\",\"value\":\"pt\"},{\"name\":\"d\",\"value\":\"gpfqbuace\"},{\"name\":\"pzfqrhhuaoppp\",\"value\":\"qeqxo\"},{\"name\":\"z\",\"value\":\"ahzxctobgbk\"}]}]}}") + .toObject(RestoreProtectionItemRequest.class); + Assertions.assertFalse(model.inPlaceRestore()); + Assertions.assertEquals(RestoreType.DISK_ATTACH, model.restoreType()); + Assertions.assertEquals("zovawjvz", model.toTime()); + Assertions.assertEquals("luthn", model.vmDestinationInfo().vmInfoList().get(0).sourceVmGuid()); + Assertions.assertEquals("prnxipeil", model.vmDestinationInfo().vmInfoList().get(0).storageAccountId()); + Assertions.assertFalse(model.vmDestinationInfo().vmInfoList().get(0).powerOnVmAfterRestore()); + Assertions.assertEquals("aejxd", model.vmDestinationInfo().vmInfoList().get(0).name()); + Assertions.assertEquals("tskzbbtdzumveek", model.vmDestinationInfo().vmInfoList().get(0).resourceGroup()); + Assertions.assertEquals("wozuhkf", model.vmDestinationInfo().vmInfoList().get(0).region()); + Assertions.assertEquals("sjyofdx", model.vmDestinationInfo().vmInfoList().get(0).networkId()); + Assertions.assertEquals("us", model.vmDestinationInfo().vmInfoList().get(0).subnetId()); + Assertions.assertTrue(model.vmDestinationInfo().vmInfoList().get(0).attachAndSwapOsDisk()); + Assertions.assertEquals("uwaboekqvke", model.vmDestinationInfo().vmInfoList().get(0).targetVmGuid()); + Assertions.assertEquals("mvb", model.vmDestinationInfo().vmInfoList().get(0).vmtags().get(0).name()); + Assertions.assertEquals("wyjsflhhcaalnjix", + model.vmDestinationInfo().vmInfoList().get(0).vmtags().get(0).value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RestoreProtectionItemRequest model = new RestoreProtectionItemRequest().withInPlaceRestore(false) + .withRestoreType(RestoreType.DISK_ATTACH) + .withToTime("zovawjvz") + .withVmDestinationInfo(new VmDestinationInfo().withVmInfoList(Arrays.asList( + new VmInfo().withSourceVmGuid("luthn") + .withStorageAccountId("prnxipeil") + .withPowerOnVmAfterRestore(false) + .withName("aejxd") + .withResourceGroup("tskzbbtdzumveek") + .withRegion("wozuhkf") + .withNetworkId("sjyofdx") + .withSubnetId("us") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("uwaboekqvke") + .withVmtags(Arrays.asList(new VmTag().withName("mvb").withValue("wyjsflhhcaalnjix"))), + new VmInfo().withSourceVmGuid("sxyawjoyaqcs") + .withStorageAccountId("yjpkiidzyexz") + .withPowerOnVmAfterRestore(true) + .withName("xhnrztfolhb") + .withResourceGroup("knalaulppg") + .withRegion("tpnapnyiropuhpig") + .withNetworkId("gylgqgitxmedjvcs") + .withSubnetId("n") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("cwzzhxgktr") + .withVmtags(Arrays.asList(new VmTag().withName("cnapkteoell").withValue("pt"), + new VmTag().withName("d").withValue("gpfqbuace"), + new VmTag().withName("pzfqrhhuaoppp").withValue("qeqxo"), + new VmTag().withName("z").withValue("ahzxctobgbk")))))); + model = BinaryData.fromObject(model).toObject(RestoreProtectionItemRequest.class); + Assertions.assertFalse(model.inPlaceRestore()); + Assertions.assertEquals(RestoreType.DISK_ATTACH, model.restoreType()); + Assertions.assertEquals("zovawjvz", model.toTime()); + Assertions.assertEquals("luthn", model.vmDestinationInfo().vmInfoList().get(0).sourceVmGuid()); + Assertions.assertEquals("prnxipeil", model.vmDestinationInfo().vmInfoList().get(0).storageAccountId()); + Assertions.assertFalse(model.vmDestinationInfo().vmInfoList().get(0).powerOnVmAfterRestore()); + Assertions.assertEquals("aejxd", model.vmDestinationInfo().vmInfoList().get(0).name()); + Assertions.assertEquals("tskzbbtdzumveek", model.vmDestinationInfo().vmInfoList().get(0).resourceGroup()); + Assertions.assertEquals("wozuhkf", model.vmDestinationInfo().vmInfoList().get(0).region()); + Assertions.assertEquals("sjyofdx", model.vmDestinationInfo().vmInfoList().get(0).networkId()); + Assertions.assertEquals("us", model.vmDestinationInfo().vmInfoList().get(0).subnetId()); + Assertions.assertTrue(model.vmDestinationInfo().vmInfoList().get(0).attachAndSwapOsDisk()); + Assertions.assertEquals("uwaboekqvke", model.vmDestinationInfo().vmInfoList().get(0).targetVmGuid()); + Assertions.assertEquals("mvb", model.vmDestinationInfo().vmInfoList().get(0).vmtags().get(0).name()); + Assertions.assertEquals("wyjsflhhcaalnjix", + model.vmDestinationInfo().vmInfoList().get(0).vmtags().get(0).value()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestoreProtectionItemResponseInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestoreProtectionItemResponseInnerTests.java new file mode 100644 index 000000000000..1deffd80a334 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RestoreProtectionItemResponseInnerTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RestoreProtectionItemResponseInner; + +public final class RestoreProtectionItemResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestoreProtectionItemResponseInner model + = BinaryData.fromString("{\"taskId\":1979583980,\"jobIds\":[\"wab\",\"ets\",\"hszhedplvwiwu\",\"mwmbes\"]}") + .toObject(RestoreProtectionItemResponseInner.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RetentionTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RetentionTests.java new file mode 100644 index 000000000000..b2a239397af7 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RetentionTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.Retention; +import org.junit.jupiter.api.Assertions; + +public final class RetentionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Retention model = BinaryData.fromString("{\"numberOfSnapshots\":1796939208}").toObject(Retention.class); + Assertions.assertEquals(1796939208, model.numberOfSnapshots()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Retention model = new Retention().withNumberOfSnapshots(1796939208); + model = BinaryData.fromObject(model).toObject(Retention.class); + Assertions.assertEquals(1796939208, model.numberOfSnapshots()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleAssignmentTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleAssignmentTests.java new file mode 100644 index 000000000000..3979e17dbbc8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleAssignmentTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RoleAssignmentTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RoleAssignment model = BinaryData.fromString( + "{\"roleName\":\"BackupAdmin\",\"entities\":[{\"id\":\"tdtbnnhadooc\",\"displayName\":\"vcikhnvpamqgx\",\"entityType\":\"User\"}]}") + .toObject(RoleAssignment.class); + Assertions.assertEquals(RoleName.BACKUP_ADMIN, model.roleName()); + Assertions.assertEquals("tdtbnnhadooc", model.entities().get(0).id()); + Assertions.assertEquals("vcikhnvpamqgx", model.entities().get(0).displayName()); + Assertions.assertEquals(EntityType.USER, model.entities().get(0).entityType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RoleAssignment model = new RoleAssignment().withRoleName(RoleName.BACKUP_ADMIN) + .withEntities(Arrays.asList(new EntityInfo().withId("tdtbnnhadooc") + .withDisplayName("vcikhnvpamqgx") + .withEntityType(EntityType.USER))); + model = BinaryData.fromObject(model).toObject(RoleAssignment.class); + Assertions.assertEquals(RoleName.BACKUP_ADMIN, model.roleName()); + Assertions.assertEquals("tdtbnnhadooc", model.entities().get(0).id()); + Assertions.assertEquals("vcikhnvpamqgx", model.entities().get(0).displayName()); + Assertions.assertEquals(EntityType.USER, model.entities().get(0).entityType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingInnerTests.java new file mode 100644 index 000000000000..c55a4dfe669f --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingInnerTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RoleMappingInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RoleMappingInner model = BinaryData.fromString( + "{\"properties\":{\"roles\":[{\"roleName\":\"BackupUser\",\"entities\":[{\"id\":\"mbqfqvmk\",\"displayName\":\"oz\",\"entityType\":\"Group\"},{\"id\":\"elxprglyatddck\",\"displayName\":\"cuejrjxgci\",\"entityType\":\"User\"},{\"id\":\"hos\",\"displayName\":\"dqrhzoymib\",\"entityType\":\"User\"},{\"id\":\"ibahwflus\",\"displayName\":\"tmhrkwofyyvoqacp\",\"entityType\":\"Group\"}]},{\"roleName\":\"SecurityAdmin\",\"entities\":[{\"id\":\"wbwo\",\"displayName\":\"washr\",\"entityType\":\"User\"},{\"id\":\"cnqxwbpokulpi\",\"displayName\":\"waasip\",\"entityType\":\"User\"},{\"id\":\"byuqerpqlp\",\"displayName\":\"cciuqgbdbutau\",\"entityType\":\"User\"}]}],\"provisioningState\":\"Failed\"},\"id\":\"whhmhykojo\",\"name\":\"afnn\",\"type\":\"lpichk\"}") + .toObject(RoleMappingInner.class); + Assertions.assertEquals(RoleName.BACKUP_USER, model.properties().roles().get(0).roleName()); + Assertions.assertEquals("mbqfqvmk", model.properties().roles().get(0).entities().get(0).id()); + Assertions.assertEquals("oz", model.properties().roles().get(0).entities().get(0).displayName()); + Assertions.assertEquals(EntityType.GROUP, model.properties().roles().get(0).entities().get(0).entityType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RoleMappingInner model + = new RoleMappingInner().withProperties(new RoleMappingProperties().withRoles(Arrays.asList( + new RoleAssignment().withRoleName(RoleName.BACKUP_USER) + .withEntities(Arrays.asList( + new EntityInfo().withId("mbqfqvmk").withDisplayName("oz").withEntityType(EntityType.GROUP), + new EntityInfo().withId("elxprglyatddck") + .withDisplayName("cuejrjxgci") + .withEntityType(EntityType.USER), + new EntityInfo().withId("hos").withDisplayName("dqrhzoymib").withEntityType(EntityType.USER), + new EntityInfo().withId("ibahwflus") + .withDisplayName("tmhrkwofyyvoqacp") + .withEntityType(EntityType.GROUP))), + new RoleAssignment().withRoleName(RoleName.SECURITY_ADMIN) + .withEntities(Arrays.asList( + new EntityInfo().withId("wbwo").withDisplayName("washr").withEntityType(EntityType.USER), + new EntityInfo().withId("cnqxwbpokulpi") + .withDisplayName("waasip") + .withEntityType(EntityType.USER), + new EntityInfo().withId("byuqerpqlp") + .withDisplayName("cciuqgbdbutau") + .withEntityType(EntityType.USER)))))); + model = BinaryData.fromObject(model).toObject(RoleMappingInner.class); + Assertions.assertEquals(RoleName.BACKUP_USER, model.properties().roles().get(0).roleName()); + Assertions.assertEquals("mbqfqvmk", model.properties().roles().get(0).entities().get(0).id()); + Assertions.assertEquals("oz", model.properties().roles().get(0).entities().get(0).displayName()); + Assertions.assertEquals(EntityType.GROUP, model.properties().roles().get(0).entities().get(0).entityType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingListResultTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingListResultTests.java new file mode 100644 index 000000000000..8af5e128dfe6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingListResultTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.RoleMappingListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import org.junit.jupiter.api.Assertions; + +public final class RoleMappingListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RoleMappingListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"roles\":[{\"roleName\":\"SecurityAdmin\",\"entities\":[{}]},{\"roleName\":\"BackupOperator\",\"entities\":[{}]},{\"roleName\":\"BackupOperator\",\"entities\":[{},{},{}]},{\"roleName\":\"BackupOperator\",\"entities\":[{},{},{}]}],\"provisioningState\":\"Succeeded\"},\"id\":\"ccjzkzivgvv\",\"name\":\"nayrhyrnxxmueedn\",\"type\":\"rdvstkwqqtch\"},{\"properties\":{\"roles\":[{\"roleName\":\"SecurityAdmin\",\"entities\":[{}]},{\"roleName\":\"MultiPersonAuthorization\",\"entities\":[{}]},{\"roleName\":\"SecurityAdmin\",\"entities\":[{},{},{}]}],\"provisioningState\":\"Canceled\"},\"id\":\"ohgwxrtfudxepxg\",\"name\":\"qagvrvm\",\"type\":\"pkukghi\"},{\"properties\":{\"roles\":[{\"roleName\":\"BackupOperator\",\"entities\":[{},{},{}]},{\"roleName\":\"BackupAdmin\",\"entities\":[{},{}]},{\"roleName\":\"BackupOperator\",\"entities\":[{}]}],\"provisioningState\":\"Canceled\"},\"id\":\"zk\",\"name\":\"foqreyfkzik\",\"type\":\"jawneaiv\"}],\"nextLink\":\"czelpcirel\"}") + .toObject(RoleMappingListResult.class); + Assertions.assertEquals(RoleName.SECURITY_ADMIN, model.value().get(0).properties().roles().get(0).roleName()); + Assertions.assertEquals("czelpcirel", model.nextLink()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingPropertiesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingPropertiesTests.java new file mode 100644 index 000000000000..015252d2d813 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingPropertiesTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityType; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RoleMappingPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RoleMappingProperties model = BinaryData.fromString( + "{\"roles\":[{\"roleName\":\"BackupAdmin\",\"entities\":[{\"id\":\"bpkkpwdre\",\"displayName\":\"ovvqfovljxywsu\",\"entityType\":\"User\"},{\"id\":\"s\",\"displayName\":\"sytgadgvraea\",\"entityType\":\"User\"}]},{\"roleName\":\"BackupOperator\",\"entities\":[{\"id\":\"rwlqu\",\"displayName\":\"jfqka\",\"entityType\":\"User\"},{\"id\":\"ipfpubji\",\"displayName\":\"wifto\",\"entityType\":\"Group\"}]},{\"roleName\":\"MultiPersonAuthorization\",\"entities\":[{\"id\":\"sgplsakn\",\"displayName\":\"fsynljphuop\",\"entityType\":\"Group\"},{\"id\":\"qiy\",\"displayName\":\"orzihle\",\"entityType\":\"Group\"},{\"id\":\"w\",\"displayName\":\"mslyzrpzbchckqqz\",\"entityType\":\"User\"},{\"id\":\"iysui\",\"displayName\":\"ynkedyatrwyhqmib\",\"entityType\":\"User\"}]},{\"roleName\":\"BackupOperator\",\"entities\":[{\"id\":\"ypyynpcdpumnzg\",\"displayName\":\"z\",\"entityType\":\"User\"},{\"id\":\"iknsorgjh\",\"displayName\":\"ldtlwwr\",\"entityType\":\"User\"},{\"id\":\"tncvokot\",\"displayName\":\"xdy\",\"entityType\":\"Group\"}]}],\"provisioningState\":\"Succeeded\"}") + .toObject(RoleMappingProperties.class); + Assertions.assertEquals(RoleName.BACKUP_ADMIN, model.roles().get(0).roleName()); + Assertions.assertEquals("bpkkpwdre", model.roles().get(0).entities().get(0).id()); + Assertions.assertEquals("ovvqfovljxywsu", model.roles().get(0).entities().get(0).displayName()); + Assertions.assertEquals(EntityType.USER, model.roles().get(0).entities().get(0).entityType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RoleMappingProperties model = new RoleMappingProperties().withRoles(Arrays.asList(new RoleAssignment() + .withRoleName(RoleName.BACKUP_ADMIN) + .withEntities(Arrays.asList( + new EntityInfo().withId("bpkkpwdre").withDisplayName("ovvqfovljxywsu").withEntityType(EntityType.USER), + new EntityInfo().withId("s").withDisplayName("sytgadgvraea").withEntityType(EntityType.USER))), + new RoleAssignment().withRoleName(RoleName.BACKUP_OPERATOR) + .withEntities(Arrays.asList( + new EntityInfo().withId("rwlqu").withDisplayName("jfqka").withEntityType(EntityType.USER), + new EntityInfo().withId("ipfpubji").withDisplayName("wifto").withEntityType(EntityType.GROUP))), + new RoleAssignment().withRoleName(RoleName.MULTI_PERSON_AUTHORIZATION) + .withEntities(Arrays.asList( + new EntityInfo().withId("sgplsakn").withDisplayName("fsynljphuop").withEntityType(EntityType.GROUP), + new EntityInfo().withId("qiy").withDisplayName("orzihle").withEntityType(EntityType.GROUP), + new EntityInfo().withId("w").withDisplayName("mslyzrpzbchckqqz").withEntityType(EntityType.USER), + new EntityInfo().withId("iysui") + .withDisplayName("ynkedyatrwyhqmib") + .withEntityType(EntityType.USER))), + new RoleAssignment().withRoleName(RoleName.BACKUP_OPERATOR) + .withEntities(Arrays.asList( + new EntityInfo().withId("ypyynpcdpumnzg").withDisplayName("z").withEntityType(EntityType.USER), + new EntityInfo().withId("iknsorgjh").withDisplayName("ldtlwwr").withEntityType(EntityType.USER), + new EntityInfo().withId("tncvokot").withDisplayName("xdy").withEntityType(EntityType.GROUP))))); + model = BinaryData.fromObject(model).toObject(RoleMappingProperties.class); + Assertions.assertEquals(RoleName.BACKUP_ADMIN, model.roles().get(0).roleName()); + Assertions.assertEquals("bpkkpwdre", model.roles().get(0).entities().get(0).id()); + Assertions.assertEquals("ovvqfovljxywsu", model.roles().get(0).entities().get(0).displayName()); + Assertions.assertEquals(EntityType.USER, model.roles().get(0).entities().get(0).entityType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsCreateOrUpdateWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..bb7f06d72b6d --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.RoleMappingInner; +import com.azure.resourcemanager.commvaultcontentstore.models.EntityInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleAssignment; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMapping; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMappingProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RoleMappingsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"roles\":[{\"roleName\":\"BackupOperator\",\"entities\":[{},{},{},{}]}],\"provisioningState\":\"Failed\"},\"id\":\"dfc\",\"name\":\"sspuunnoxyhkx\",\"type\":\"qddrihpfhoqcaae\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RoleMapping response + = manager.roleMappings() + .createOrUpdateWithResponse("db", "evwrdnhfuk", + new RoleMappingInner() + .withProperties(new RoleMappingProperties().withRoles(Arrays.asList( + new RoleAssignment().withRoleName(RoleName.MULTI_PERSON_AUTHORIZATION) + .withEntities(Arrays.asList(new EntityInfo(), new EntityInfo(), new EntityInfo(), + new EntityInfo())), + new RoleAssignment().withRoleName(RoleName.SECURITY_ADMIN) + .withEntities(Arrays.asList(new EntityInfo(), new EntityInfo()))))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(RoleName.BACKUP_OPERATOR, response.properties().roles().get(0).roleName()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsDeleteByResourceGroupWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..6a0bf9fd7349 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RoleMappingsDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.roleMappings().deleteByResourceGroupWithResponse("dao", "djvlpj", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsGetWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsGetWithResponseMockTests.java new file mode 100644 index 000000000000..210b0eab0b10 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsGetWithResponseMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMapping; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +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 RoleMappingsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"roles\":[{\"roleName\":\"MultiPersonAuthorization\",\"entities\":[{},{},{}]},{\"roleName\":\"SecurityAdmin\",\"entities\":[{},{},{},{}]},{\"roleName\":\"SecurityAdmin\",\"entities\":[{},{},{},{}]},{\"roleName\":\"BackupUser\",\"entities\":[{}]}],\"provisioningState\":\"Succeeded\"},\"id\":\"fnczdwvvbalx\",\"name\":\"l\",\"type\":\"chp\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RoleMapping response = manager.roleMappings() + .getWithResponse("bdgiogsjk", "nwqjnoba", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(RoleName.MULTI_PERSON_AUTHORIZATION, response.properties().roles().get(0).roleName()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsListMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsListMockTests.java new file mode 100644 index 000000000000..8754bd36549e --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RoleMappingsListMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleMapping; +import com.azure.resourcemanager.commvaultcontentstore.models.RoleName; +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 RoleMappingsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"roles\":[{\"roleName\":\"MultiPersonAuthorization\",\"entities\":[{},{}]},{\"roleName\":\"BackupUser\",\"entities\":[{},{}]}],\"provisioningState\":\"Canceled\"},\"id\":\"lapzwyrp\",\"name\":\"ogtqxepnylbf\",\"type\":\"ajlyjtlvofqzhv\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.roleMappings().list("xkzb", "msgeivsiykzk", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(RoleName.MULTI_PERSON_AUTHORIZATION, + response.iterator().next().properties().roles().get(0).roleName()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RuleTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RuleTests.java new file mode 100644 index 000000000000..560fc2aee2a9 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/RuleTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.Operator; +import com.azure.resourcemanager.commvaultcontentstore.models.Rule; +import com.azure.resourcemanager.commvaultcontentstore.models.RuleProperty; +import org.junit.jupiter.api.Assertions; + +public final class RuleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Rule model + = BinaryData.fromString("{\"property\":\"resourceGroup\",\"operator\":\"contains\",\"value\":\"aex\"}") + .toObject(Rule.class); + Assertions.assertEquals(RuleProperty.RESOURCE_GROUP, model.property()); + Assertions.assertEquals(Operator.CONTAINS, model.operator()); + Assertions.assertEquals("aex", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Rule model + = new Rule().withProperty(RuleProperty.RESOURCE_GROUP).withOperator(Operator.CONTAINS).withValue("aex"); + model = BinaryData.fromObject(model).toObject(Rule.class); + Assertions.assertEquals(RuleProperty.RESOURCE_GROUP, model.property()); + Assertions.assertEquals(Operator.CONTAINS, model.operator()); + Assertions.assertEquals("aex", model.value()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSDataTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSDataTests.java new file mode 100644 index 000000000000..d8e93c35be57 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSDataTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSData; +import org.junit.jupiter.api.Assertions; + +public final class SaaSDataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SaaSData model = BinaryData.fromString("{\"saaSResourceId\":\"u\"}").toObject(SaaSData.class); + Assertions.assertEquals("u", model.saaSResourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SaaSData model = new SaaSData().withSaaSResourceId("u"); + model = BinaryData.fromObject(model).toObject(SaaSData.class); + Assertions.assertEquals("u", model.saaSResourceId()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSOperationGroupsActivateResourceMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSOperationGroupsActivateResourceMockTests.java new file mode 100644 index 000000000000..a21c5f63d961 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSOperationGroupsActivateResourceMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.ActivateSaaSParameterRequest; +import com.azure.resourcemanager.commvaultcontentstore.models.SaaSResourceDetailsResponse; +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 SaaSOperationGroupsActivateResourceMockTests { + @Test + public void testActivateResource() throws Exception { + String responseStr + = "{\"saaSResourceId\":\"y\",\"id\":\"xwlmdjr\",\"name\":\"vfgbvfvpdboda\",\"type\":\"izsjqlhkrr\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SaaSResourceDetailsResponse response = manager.saaSOperationGroups() + .activateResource(new ActivateSaaSParameterRequest().withSaaSGuid("wxqibyq"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("y", response.saaSResourceId()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSResourceDetailsResponseInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSResourceDetailsResponseInnerTests.java new file mode 100644 index 000000000000..2fa2771adf08 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/SaaSResourceDetailsResponseInnerTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.SaaSResourceDetailsResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class SaaSResourceDetailsResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SaaSResourceDetailsResponseInner model = BinaryData + .fromString( + "{\"saaSResourceId\":\"vvtpgvdfgio\",\"id\":\"ftutqxlngxlefgu\",\"name\":\"nxkrx\",\"type\":\"qmi\"}") + .toObject(SaaSResourceDetailsResponseInner.class); + Assertions.assertEquals("vvtpgvdfgio", model.saaSResourceId()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ScheduleTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ScheduleTests.java new file mode 100644 index 000000000000..4d902da28128 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/ScheduleTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.BackUpType; +import com.azure.resourcemanager.commvaultcontentstore.models.DayOfWeek; +import com.azure.resourcemanager.commvaultcontentstore.models.Frequency; +import com.azure.resourcemanager.commvaultcontentstore.models.MonthOfYear; +import com.azure.resourcemanager.commvaultcontentstore.models.Schedule; +import com.azure.resourcemanager.commvaultcontentstore.models.WeekOfMonth; +import com.azure.resourcemanager.commvaultcontentstore.models.WeeklyDays; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ScheduleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Schedule model = BinaryData.fromString( + "{\"backupType\":\"FULL\",\"frequency\":\"daily\",\"runsEvery\":1670044751,\"weekOfMonth\":\"FOURTH\",\"dayOfWeek\":\"WEDNESDAY\",\"monthOfYear\":\"JULY\",\"dayOfMonth\":517393984,\"weeklyDays\":[\"WEDNESDAY\",\"WEDNESDAY\",\"SUNDAY\",\"FRIDAY\"],\"time\":\"v\",\"timeZone\":\"xmzsbbzogg\"}") + .toObject(Schedule.class); + Assertions.assertEquals(BackUpType.FULL, model.backupType()); + Assertions.assertEquals(Frequency.DAILY, model.frequency()); + Assertions.assertEquals(1670044751, model.runsEvery()); + Assertions.assertEquals(WeekOfMonth.FOURTH, model.weekOfMonth()); + Assertions.assertEquals(DayOfWeek.WEDNESDAY, model.dayOfWeek()); + Assertions.assertEquals(MonthOfYear.JULY, model.monthOfYear()); + Assertions.assertEquals(517393984, model.dayOfMonth()); + Assertions.assertEquals(WeeklyDays.WEDNESDAY, model.weeklyDays().get(0)); + Assertions.assertEquals("v", model.time()); + Assertions.assertEquals("xmzsbbzogg", model.timeZone()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Schedule model = new Schedule().withBackupType(BackUpType.FULL) + .withFrequency(Frequency.DAILY) + .withRunsEvery(1670044751) + .withWeekOfMonth(WeekOfMonth.FOURTH) + .withDayOfWeek(DayOfWeek.WEDNESDAY) + .withMonthOfYear(MonthOfYear.JULY) + .withDayOfMonth(517393984) + .withWeeklyDays( + Arrays.asList(WeeklyDays.WEDNESDAY, WeeklyDays.WEDNESDAY, WeeklyDays.SUNDAY, WeeklyDays.FRIDAY)) + .withTime("v") + .withTimeZone("xmzsbbzogg"); + model = BinaryData.fromObject(model).toObject(Schedule.class); + Assertions.assertEquals(BackUpType.FULL, model.backupType()); + Assertions.assertEquals(Frequency.DAILY, model.frequency()); + Assertions.assertEquals(1670044751, model.runsEvery()); + Assertions.assertEquals(WeekOfMonth.FOURTH, model.weekOfMonth()); + Assertions.assertEquals(DayOfWeek.WEDNESDAY, model.dayOfWeek()); + Assertions.assertEquals(MonthOfYear.JULY, model.monthOfYear()); + Assertions.assertEquals(517393984, model.dayOfMonth()); + Assertions.assertEquals(WeeklyDays.WEDNESDAY, model.weeklyDays().get(0)); + Assertions.assertEquals("v", model.time()); + Assertions.assertEquals("xmzsbbzogg", model.timeZone()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StopBackupProtectionGroupRequestTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StopBackupProtectionGroupRequestTests.java new file mode 100644 index 000000000000..9beacd4b5530 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StopBackupProtectionGroupRequestTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.StopBackupProtectionGroupRequest; +import org.junit.jupiter.api.Assertions; + +public final class StopBackupProtectionGroupRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StopBackupProtectionGroupRequest model = BinaryData.fromString("{\"reason\":\"j\",\"comment\":\"xdjzlmwlxk\"}") + .toObject(StopBackupProtectionGroupRequest.class); + Assertions.assertEquals("j", model.reason()); + Assertions.assertEquals("xdjzlmwlxk", model.comment()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StopBackupProtectionGroupRequest model + = new StopBackupProtectionGroupRequest().withReason("j").withComment("xdjzlmwlxk"); + model = BinaryData.fromObject(model).toObject(StopBackupProtectionGroupRequest.class); + Assertions.assertEquals("j", model.reason()); + Assertions.assertEquals("xdjzlmwlxk", model.comment()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StorageInnerTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StorageInnerTests.java new file mode 100644 index 000000000000..b37d3befc1d6 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StorageInnerTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.fluent.models.StorageInner; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; +import org.junit.jupiter.api.Assertions; + +public final class StorageInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageInner model = BinaryData.fromString( + "{\"properties\":{\"location\":\"thz\",\"storageType\":\"Air_Gap_Protect\",\"vendor\":\"Azure_Blob_Storage\",\"class\":\"HOT\",\"provisioningState\":\"Succeeded\"},\"id\":\"hjybigehoqfbo\",\"name\":\"skanyk\",\"type\":\"zlcuiywgqywgndrv\"}") + .toObject(StorageInner.class); + Assertions.assertEquals("thz", model.properties().location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, model.properties().storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, model.properties().vendor()); + Assertions.assertEquals(StorageClassType.HOT, model.properties().classProperty()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageInner model = new StorageInner().withProperties(new StorageProperties().withLocation("thz") + .withStorageType(StorageType.AIR_GAP_PROTECT) + .withVendor(Vendor.AZURE_BLOB_STORAGE) + .withClassProperty(StorageClassType.HOT)); + model = BinaryData.fromObject(model).toObject(StorageInner.class); + Assertions.assertEquals("thz", model.properties().location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, model.properties().storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, model.properties().vendor()); + Assertions.assertEquals(StorageClassType.HOT, model.properties().classProperty()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StorageListResultTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StorageListResultTests.java new file mode 100644 index 000000000000..e2631996d272 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StorageListResultTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.implementation.models.StorageListResult; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; +import org.junit.jupiter.api.Assertions; + +public final class StorageListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"location\":\"m\",\"storageType\":\"Air_Gap_Protect\",\"vendor\":\"Azure_Blob_Storage\",\"class\":\"COLD\",\"provisioningState\":\"Failed\"},\"id\":\"lzevgbmqjqab\",\"name\":\"y\",\"type\":\"mivkwlzuvcc\"}],\"nextLink\":\"nfnbacfionlebxe\"}") + .toObject(StorageListResult.class); + Assertions.assertEquals("m", model.value().get(0).properties().location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, model.value().get(0).properties().storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, model.value().get(0).properties().vendor()); + Assertions.assertEquals(StorageClassType.COOL, model.value().get(0).properties().classProperty()); + Assertions.assertEquals("nfnbacfionlebxe", model.nextLink()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragePlanTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragePlanTests.java new file mode 100644 index 000000000000..8a5b1d603d22 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragePlanTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.BackupRuleType; +import com.azure.resourcemanager.commvaultcontentstore.models.ExtendedRetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.RetentionTime; +import com.azure.resourcemanager.commvaultcontentstore.models.StoragePlan; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class StoragePlanTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StoragePlan model = BinaryData.fromString( + "{\"name\":\"wkuofoskghsauu\",\"storagePoolId\":\"jmvxie\",\"copyName\":\"ugidyjrr\",\"copyPrecedence\":207335442,\"retentionPeriod\":1774598517,\"retentionTime\":\"monthly\",\"backupRuleType\":\"ALL_JOBS\",\"extendedRetention\":[{\"retentionTime\":\"monthly\",\"retentionPeriod\":66931546,\"backupRuleType\":\"HALF_YEARLY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":962869237,\"backupRuleType\":\"WEEKLY_FULLS\"},{\"retentionTime\":\"monthly\",\"retentionPeriod\":1882750055,\"backupRuleType\":\"ALL_JOBS\"}]}") + .toObject(StoragePlan.class); + Assertions.assertEquals("wkuofoskghsauu", model.name()); + Assertions.assertEquals("jmvxie", model.storagePoolId()); + Assertions.assertEquals("ugidyjrr", model.copyName()); + Assertions.assertEquals(207335442, model.copyPrecedence()); + Assertions.assertEquals(1774598517, model.retentionPeriod()); + Assertions.assertEquals(RetentionTime.MONTHLY, model.retentionTime()); + Assertions.assertEquals(BackupRuleType.ALL_JOBS, model.backupRuleType()); + Assertions.assertEquals(RetentionTime.MONTHLY, model.extendedRetention().get(0).retentionTime()); + Assertions.assertEquals(66931546, model.extendedRetention().get(0).retentionPeriod()); + Assertions.assertEquals(BackupRuleType.HALF_YEARLY_FULLS, model.extendedRetention().get(0).backupRuleType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StoragePlan model = new StoragePlan().withName("wkuofoskghsauu") + .withStoragePoolId("jmvxie") + .withCopyName("ugidyjrr") + .withCopyPrecedence(207335442) + .withRetentionPeriod(1774598517) + .withRetentionTime(RetentionTime.MONTHLY) + .withBackupRuleType(BackupRuleType.ALL_JOBS) + .withExtendedRetention(Arrays.asList( + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(66931546) + .withBackupRuleType(BackupRuleType.HALF_YEARLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(962869237) + .withBackupRuleType(BackupRuleType.WEEKLY_FULLS), + new ExtendedRetentionTime().withRetentionTime(RetentionTime.MONTHLY) + .withRetentionPeriod(1882750055) + .withBackupRuleType(BackupRuleType.ALL_JOBS))); + model = BinaryData.fromObject(model).toObject(StoragePlan.class); + Assertions.assertEquals("wkuofoskghsauu", model.name()); + Assertions.assertEquals("jmvxie", model.storagePoolId()); + Assertions.assertEquals("ugidyjrr", model.copyName()); + Assertions.assertEquals(207335442, model.copyPrecedence()); + Assertions.assertEquals(1774598517, model.retentionPeriod()); + Assertions.assertEquals(RetentionTime.MONTHLY, model.retentionTime()); + Assertions.assertEquals(BackupRuleType.ALL_JOBS, model.backupRuleType()); + Assertions.assertEquals(RetentionTime.MONTHLY, model.extendedRetention().get(0).retentionTime()); + Assertions.assertEquals(66931546, model.extendedRetention().get(0).retentionPeriod()); + Assertions.assertEquals(BackupRuleType.HALF_YEARLY_FULLS, model.extendedRetention().get(0).backupRuleType()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragePropertiesTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragePropertiesTests.java new file mode 100644 index 000000000000..277ce8d06580 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragePropertiesTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; +import org.junit.jupiter.api.Assertions; + +public final class StoragePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageProperties model = BinaryData.fromString( + "{\"location\":\"nhzgpphrcgyn\",\"storageType\":\"Air_Gap_Protect\",\"vendor\":\"Azure_Blob_Storage\",\"class\":\"COLD\",\"provisioningState\":\"Succeeded\"}") + .toObject(StorageProperties.class); + Assertions.assertEquals("nhzgpphrcgyn", model.location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, model.storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, model.vendor()); + Assertions.assertEquals(StorageClassType.COOL, model.classProperty()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageProperties model = new StorageProperties().withLocation("nhzgpphrcgyn") + .withStorageType(StorageType.AIR_GAP_PROTECT) + .withVendor(Vendor.AZURE_BLOB_STORAGE) + .withClassProperty(StorageClassType.COOL); + model = BinaryData.fromObject(model).toObject(StorageProperties.class); + Assertions.assertEquals("nhzgpphrcgyn", model.location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, model.storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, model.vendor()); + Assertions.assertEquals(StorageClassType.COOL, model.classProperty()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesCreateOrUpdateMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..ad8aa702194b --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesCreateOrUpdateMockTests.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.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.Storage; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageProperties; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; +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 StoragesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"location\":\"cgpik\",\"storageType\":\"Air_Gap_Protect\",\"vendor\":\"Azure_Blob_Storage\",\"class\":\"HOT\",\"provisioningState\":\"Succeeded\"},\"id\":\"anlfzxiavrmbz\",\"name\":\"nokixrjqcirgz\",\"type\":\"frl\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Storage response = manager.storages() + .define("x") + .withExistingCloudAccount("ldgmfpgvmpip", "slthaq") + .withProperties(new StorageProperties().withLocation("mwutwbdsre") + .withStorageType(StorageType.AIR_GAP_PROTECT) + .withVendor(Vendor.AZURE_BLOB_STORAGE) + .withClassProperty(StorageClassType.HOT)) + .create(); + + Assertions.assertEquals("cgpik", response.properties().location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, response.properties().storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, response.properties().vendor()); + Assertions.assertEquals(StorageClassType.HOT, response.properties().classProperty()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesGetWithResponseMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesGetWithResponseMockTests.java new file mode 100644 index 000000000000..50f198c8bedc --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesGetWithResponseMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.Storage; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; +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 StoragesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"location\":\"hgbijt\",\"storageType\":\"Air_Gap_Protect\",\"vendor\":\"Azure_Blob_Storage\",\"class\":\"HOT\",\"provisioningState\":\"Failed\"},\"id\":\"jabibsystawf\",\"name\":\"djpvkvpbjxbkz\",\"type\":\"zkdvncja\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Storage response = manager.storages() + .getWithResponse("bdeibqipqk", "hvxndzwmkrefajpj", "rwkq", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hgbijt", response.properties().location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, response.properties().storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, response.properties().vendor()); + Assertions.assertEquals(StorageClassType.HOT, response.properties().classProperty()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesListByCloudAccountMockTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesListByCloudAccountMockTests.java new file mode 100644 index 000000000000..3360e1094578 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/StoragesListByCloudAccountMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.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.commvaultcontentstore.CommvaultContentStoreManager; +import com.azure.resourcemanager.commvaultcontentstore.models.Storage; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageClassType; +import com.azure.resourcemanager.commvaultcontentstore.models.StorageType; +import com.azure.resourcemanager.commvaultcontentstore.models.Vendor; +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 StoragesListByCloudAccountMockTests { + @Test + public void testListByCloudAccount() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"location\":\"ouw\",\"storageType\":\"Air_Gap_Protect\",\"vendor\":\"Azure_Blob_Storage\",\"class\":\"COLD\",\"provisioningState\":\"Failed\"},\"id\":\"eeyebi\",\"name\":\"ikayuhqlbjbsybb\",\"type\":\"wrv\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommvaultContentStoreManager manager = CommvaultContentStoreManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.storages().listByCloudAccount("udurgkakmokz", "jjklff", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ouw", response.iterator().next().properties().location()); + Assertions.assertEquals(StorageType.AIR_GAP_PROTECT, response.iterator().next().properties().storageType()); + Assertions.assertEquals(Vendor.AZURE_BLOB_STORAGE, response.iterator().next().properties().vendor()); + Assertions.assertEquals(StorageClassType.COOL, response.iterator().next().properties().classProperty()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/UserAssignedIdentityTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..fd683fb905b8 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/UserAssignedIdentityTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model + = BinaryData.fromString("{\"principalId\":\"mmnkzsmodmgl\",\"clientId\":\"gpbkwtmut\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/UserDetailsTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/UserDetailsTests.java new file mode 100644 index 000000000000..ec2af46bdcd4 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/UserDetailsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.UserDetails; +import org.junit.jupiter.api.Assertions; + +public final class UserDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserDetails model = BinaryData.fromString( + "{\"firstName\":\"ujitcjcz\",\"lastName\":\"evndh\",\"emailAddress\":\"wpdappdsbdkv\",\"upn\":\"wjfeusnhutjel\",\"phoneNumber\":\"rl\"}") + .toObject(UserDetails.class); + Assertions.assertEquals("ujitcjcz", model.firstName()); + Assertions.assertEquals("evndh", model.lastName()); + Assertions.assertEquals("wpdappdsbdkv", model.emailAddress()); + Assertions.assertEquals("wjfeusnhutjel", model.upn()); + Assertions.assertEquals("rl", model.phoneNumber()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserDetails model = new UserDetails().withFirstName("ujitcjcz") + .withLastName("evndh") + .withEmailAddress("wpdappdsbdkv") + .withUpn("wjfeusnhutjel") + .withPhoneNumber("rl"); + model = BinaryData.fromObject(model).toObject(UserDetails.class); + Assertions.assertEquals("ujitcjcz", model.firstName()); + Assertions.assertEquals("evndh", model.lastName()); + Assertions.assertEquals("wpdappdsbdkv", model.emailAddress()); + Assertions.assertEquals("wjfeusnhutjel", model.upn()); + Assertions.assertEquals("rl", model.phoneNumber()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmDestinationInfoTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmDestinationInfoTests.java new file mode 100644 index 000000000000..988503687c19 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmDestinationInfoTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.VmDestinationInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VmDestinationInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmDestinationInfo model = BinaryData.fromString( + "{\"vmInfoList\":[{\"sourceVmGuid\":\"oizpostmgrcfbun\",\"storageAccountId\":\"mfqjhhkxbp\",\"powerOnVmAfterRestore\":true,\"name\":\"jhxxjyn\",\"resourceGroup\":\"divkrt\",\"region\":\"bxqz\",\"networkId\":\"zjf\",\"subnetId\":\"vjfdx\",\"attachAndSwapOsDisk\":false,\"targetVmGuid\":\"tvtc\",\"vmtags\":[{\"name\":\"tdo\",\"value\":\"mcbxvwvxysl\"}]},{\"sourceVmGuid\":\"bhsfxob\",\"storageAccountId\":\"ytkblmpew\",\"powerOnVmAfterRestore\":true,\"name\":\"krvrns\",\"resourceGroup\":\"hqjohxcrsbfova\",\"region\":\"ruvw\",\"networkId\":\"sqfsubcgjbirxb\",\"subnetId\":\"bsrfbj\",\"attachAndSwapOsDisk\":false,\"targetVmGuid\":\"ssotftpv\",\"vmtags\":[{\"name\":\"exilzznfqqnvwpmq\",\"value\":\"aruoujmkcjhwqyt\"},{\"name\":\"r\",\"value\":\"bnw\"},{\"name\":\"ewgdrjervn\",\"value\":\"enq\"},{\"name\":\"eh\",\"value\":\"ndoygmifthnzdnd\"}]}]}") + .toObject(VmDestinationInfo.class); + Assertions.assertEquals("oizpostmgrcfbun", model.vmInfoList().get(0).sourceVmGuid()); + Assertions.assertEquals("mfqjhhkxbp", model.vmInfoList().get(0).storageAccountId()); + Assertions.assertTrue(model.vmInfoList().get(0).powerOnVmAfterRestore()); + Assertions.assertEquals("jhxxjyn", model.vmInfoList().get(0).name()); + Assertions.assertEquals("divkrt", model.vmInfoList().get(0).resourceGroup()); + Assertions.assertEquals("bxqz", model.vmInfoList().get(0).region()); + Assertions.assertEquals("zjf", model.vmInfoList().get(0).networkId()); + Assertions.assertEquals("vjfdx", model.vmInfoList().get(0).subnetId()); + Assertions.assertFalse(model.vmInfoList().get(0).attachAndSwapOsDisk()); + Assertions.assertEquals("tvtc", model.vmInfoList().get(0).targetVmGuid()); + Assertions.assertEquals("tdo", model.vmInfoList().get(0).vmtags().get(0).name()); + Assertions.assertEquals("mcbxvwvxysl", model.vmInfoList().get(0).vmtags().get(0).value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmDestinationInfo model = new VmDestinationInfo().withVmInfoList(Arrays.asList( + new VmInfo().withSourceVmGuid("oizpostmgrcfbun") + .withStorageAccountId("mfqjhhkxbp") + .withPowerOnVmAfterRestore(true) + .withName("jhxxjyn") + .withResourceGroup("divkrt") + .withRegion("bxqz") + .withNetworkId("zjf") + .withSubnetId("vjfdx") + .withAttachAndSwapOsDisk(false) + .withTargetVmGuid("tvtc") + .withVmtags(Arrays.asList(new VmTag().withName("tdo").withValue("mcbxvwvxysl"))), + new VmInfo().withSourceVmGuid("bhsfxob") + .withStorageAccountId("ytkblmpew") + .withPowerOnVmAfterRestore(true) + .withName("krvrns") + .withResourceGroup("hqjohxcrsbfova") + .withRegion("ruvw") + .withNetworkId("sqfsubcgjbirxb") + .withSubnetId("bsrfbj") + .withAttachAndSwapOsDisk(false) + .withTargetVmGuid("ssotftpv") + .withVmtags(Arrays.asList(new VmTag().withName("exilzznfqqnvwpmq").withValue("aruoujmkcjhwqyt"), + new VmTag().withName("r").withValue("bnw"), new VmTag().withName("ewgdrjervn").withValue("enq"), + new VmTag().withName("eh").withValue("ndoygmifthnzdnd"))))); + model = BinaryData.fromObject(model).toObject(VmDestinationInfo.class); + Assertions.assertEquals("oizpostmgrcfbun", model.vmInfoList().get(0).sourceVmGuid()); + Assertions.assertEquals("mfqjhhkxbp", model.vmInfoList().get(0).storageAccountId()); + Assertions.assertTrue(model.vmInfoList().get(0).powerOnVmAfterRestore()); + Assertions.assertEquals("jhxxjyn", model.vmInfoList().get(0).name()); + Assertions.assertEquals("divkrt", model.vmInfoList().get(0).resourceGroup()); + Assertions.assertEquals("bxqz", model.vmInfoList().get(0).region()); + Assertions.assertEquals("zjf", model.vmInfoList().get(0).networkId()); + Assertions.assertEquals("vjfdx", model.vmInfoList().get(0).subnetId()); + Assertions.assertFalse(model.vmInfoList().get(0).attachAndSwapOsDisk()); + Assertions.assertEquals("tvtc", model.vmInfoList().get(0).targetVmGuid()); + Assertions.assertEquals("tdo", model.vmInfoList().get(0).vmtags().get(0).name()); + Assertions.assertEquals("mcbxvwvxysl", model.vmInfoList().get(0).vmtags().get(0).value()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmInfoTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmInfoTests.java new file mode 100644 index 000000000000..d87c3dadd430 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmInfoTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.VmInfo; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VmInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmInfo model = BinaryData.fromString( + "{\"sourceVmGuid\":\"l\",\"storageAccountId\":\"nayqi\",\"powerOnVmAfterRestore\":true,\"name\":\"uhavhql\",\"resourceGroup\":\"humaqolbgyc\",\"region\":\"iertgccymvaolp\",\"networkId\":\"lqlfm\",\"subnetId\":\"n\",\"attachAndSwapOsDisk\":true,\"targetVmGuid\":\"zpswiydmc\",\"vmtags\":[{\"name\":\"zdxss\",\"value\":\"dbzm\"},{\"name\":\"vdfznudaodvxzb\",\"value\":\"cblylpstdbhhxsr\"},{\"name\":\"dzu\",\"value\":\"erscdntne\"}]}") + .toObject(VmInfo.class); + Assertions.assertEquals("l", model.sourceVmGuid()); + Assertions.assertEquals("nayqi", model.storageAccountId()); + Assertions.assertTrue(model.powerOnVmAfterRestore()); + Assertions.assertEquals("uhavhql", model.name()); + Assertions.assertEquals("humaqolbgyc", model.resourceGroup()); + Assertions.assertEquals("iertgccymvaolp", model.region()); + Assertions.assertEquals("lqlfm", model.networkId()); + Assertions.assertEquals("n", model.subnetId()); + Assertions.assertTrue(model.attachAndSwapOsDisk()); + Assertions.assertEquals("zpswiydmc", model.targetVmGuid()); + Assertions.assertEquals("zdxss", model.vmtags().get(0).name()); + Assertions.assertEquals("dbzm", model.vmtags().get(0).value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmInfo model = new VmInfo().withSourceVmGuid("l") + .withStorageAccountId("nayqi") + .withPowerOnVmAfterRestore(true) + .withName("uhavhql") + .withResourceGroup("humaqolbgyc") + .withRegion("iertgccymvaolp") + .withNetworkId("lqlfm") + .withSubnetId("n") + .withAttachAndSwapOsDisk(true) + .withTargetVmGuid("zpswiydmc") + .withVmtags(Arrays.asList(new VmTag().withName("zdxss").withValue("dbzm"), + new VmTag().withName("vdfznudaodvxzb").withValue("cblylpstdbhhxsr"), + new VmTag().withName("dzu").withValue("erscdntne"))); + model = BinaryData.fromObject(model).toObject(VmInfo.class); + Assertions.assertEquals("l", model.sourceVmGuid()); + Assertions.assertEquals("nayqi", model.storageAccountId()); + Assertions.assertTrue(model.powerOnVmAfterRestore()); + Assertions.assertEquals("uhavhql", model.name()); + Assertions.assertEquals("humaqolbgyc", model.resourceGroup()); + Assertions.assertEquals("iertgccymvaolp", model.region()); + Assertions.assertEquals("lqlfm", model.networkId()); + Assertions.assertEquals("n", model.subnetId()); + Assertions.assertTrue(model.attachAndSwapOsDisk()); + Assertions.assertEquals("zpswiydmc", model.targetVmGuid()); + Assertions.assertEquals("zdxss", model.vmtags().get(0).name()); + Assertions.assertEquals("dbzm", model.vmtags().get(0).value()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmListItemTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmListItemTests.java new file mode 100644 index 000000000000..7f19b0cb3eba --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmListItemTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.VmListItem; +import org.junit.jupiter.api.Assertions; + +public final class VmListItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmListItem model = BinaryData.fromString("{\"vmGuid\":\"gureodkwobdag\"}").toObject(VmListItem.class); + Assertions.assertEquals("gureodkwobdag", model.vmGuid()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmListItem model = new VmListItem().withVmGuid("gureodkwobdag"); + model = BinaryData.fromObject(model).toObject(VmListItem.class); + Assertions.assertEquals("gureodkwobdag", model.vmGuid()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmTagTests.java b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmTagTests.java new file mode 100644 index 000000000000..ce1a9a7d4273 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/src/test/java/com/azure/resourcemanager/commvaultcontentstore/generated/VmTagTests.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.commvaultcontentstore.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commvaultcontentstore.models.VmTag; +import org.junit.jupiter.api.Assertions; + +public final class VmTagTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmTag model + = BinaryData.fromString("{\"name\":\"fiwjmygtdssls\",\"value\":\"tmweriofzpyq\"}").toObject(VmTag.class); + Assertions.assertEquals("fiwjmygtdssls", model.name()); + Assertions.assertEquals("tmweriofzpyq", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmTag model = new VmTag().withName("fiwjmygtdssls").withValue("tmweriofzpyq"); + model = BinaryData.fromObject(model).toObject(VmTag.class); + Assertions.assertEquals("fiwjmygtdssls", model.name()); + Assertions.assertEquals("tmweriofzpyq", model.value()); + } +} diff --git a/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/tsp-location.yaml b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/tsp-location.yaml new file mode 100644 index 000000000000..40f43f0f4533 --- /dev/null +++ b/sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrcommvault/Commvault.ContentStore.Management +commit: c988a5e360aca671131d37955d362f51f0b5c677 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/commvaultcontentstore/ci.yml b/sdk/commvaultcontentstore/ci.yml new file mode 100644 index 000000000000..22334d427ebd --- /dev/null +++ b/sdk/commvaultcontentstore/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/commvaultcontentstore/ci.yml + - sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/ + exclude: + - sdk/commvaultcontentstore/pom.xml + - sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/commvaultcontentstore/ci.yml + - sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/ + exclude: + - sdk/commvaultcontentstore/pom.xml + - sdk/commvaultcontentstore/azure-resourcemanager-commvaultcontentstore/pom.xml + +parameters: + - name: release_azureresourcemanagercommvaultcontentstore + displayName: azure-resourcemanager-commvaultcontentstore + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: commvaultcontentstore + Artifacts: + - name: azure-resourcemanager-commvaultcontentstore + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercommvaultcontentstore + releaseInBatch: ${{ parameters.release_azureresourcemanagercommvaultcontentstore }} diff --git a/sdk/commvaultcontentstore/pom.xml b/sdk/commvaultcontentstore/pom.xml new file mode 100644 index 000000000000..fabb96d46d28 --- /dev/null +++ b/sdk/commvaultcontentstore/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-commvaultcontentstore-service + pom + 1.0.0 + + + azure-resourcemanager-commvaultcontentstore + +